Jump to content

Very Strange FileFindNextFile behavior found

Recommended Posts

Posted (edited)


I have found a very very strange behavior with FileFindNextFile and AutoIt v.

At first my example script (adapted from help file):


#include <MsgBoxConstants.au3>


Func Example()
    ; Assign a Local variable the search handle of all files in the current directory.
    Local $hSearch = FileFindFirstFile("C:\Some Tests\Profildaten Backup\Desktop\Yi\uskin\Skins\Default\*.*")

    ; Check if the search was successful, if not display a message and return False.
    If $hSearch = -1 Then
        MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.")
        Return False

    ; Assign a Local variable the empty string which will contain the files names found.
    Local $sFileName = "", $iResult = 0

    While 1
        $sFileName = FileFindNextFile($hSearch)
        ; If there is no more file matching the search.
        If @error Then ExitLoop

        ; Display the file name.


    ; Close the search handle.
EndFunc   ;==>Example


You can see, the script should output all Files in a path. Should be simple, right?
The ConsoleWrite Output looks like this:


So all fine!

Sooo....now i put the exact same folder on a network drive. Let it be drive S: for example (effect is the same as with \\SERVERNAME\SHARE....)
Then the output looks like this:


Where doese "." and ".." come from?! I really have no idea what is happening here ^^
Could this be an AutoIt bug? (Or just my stupid Win10 -.-)

Thanks for your help in advance!!

PS: I attached you a .zip with the testfiles. So you have the same enviroment for testings.



Edited by ISI360

Share this post

Link to post
Share on other sites
Posted (edited)

I just want you to know that i think it´s really my windows 10 pc what´s going crazy here... (Or has somebody testes this and has the same problems like me?)
I tested it today on my work pc (also win 10) and it is working fine here! (And other win7 machines too)

So i think it is time to finally reinstall windows new on my home computer :P

Edited by ISI360

Share this post

Link to post
Share on other sites


Working with php on a server you'll find . and .. too. I guess it's not unusual at all.


SciTE4AutoIt =   AutoIt =   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post

Link to post
Share on other sites

@ISI360: on C drive I get the same results. When I put the files from the Zip file to my network drive with the drive letter L I get the same result but the order is different but "." or ".." chars.

Output for L drive:



Tested on Win10 x64 and AutoIt v3.3.14.5 /

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post

Link to post
Share on other sites


I once ran into a user with what seems a very similar problem - see this post and subsequent - which appeared to be caused by the fact that the server was using a different OS and transferring the FileFindFolder return to Windows meant that we got the additional . and .. items. Could this be the case here?


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

A single dot is the current directory
a double dot is the parent directory

If you do a Dir from the command prompt you will see that these are always the first 2 listed. 
They are mostly used for specifying paths relative to the current directory.

  • Like 1

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post

Link to post
Share on other sites
Posted (edited)

Thanks for the infos guys!

Yeah the strange thing is i never had this before on any system. Its the first time for me i got "." or ".." returned by FileFindNextFile.

And @Melba23 the target system (server) in this case is a Windows Server 2016...so they SHOULD be making the same...in theory ^^

But meanwhile i have accepted this as a "strange thing". And it can easily filtered by parsing the results.
Maybe its gone when i reinstall my pc.

Edited by ISI360

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now