_FileFindEx
Get More from File/Folder Searches
(formerly _WinAPI_FileFind)
Since it's always bugged me that the AutoIT implementation of 'FindFirstFile' and 'FindNextFile' only returned filenames and that extra calls had to be made to get file-size, attributes, short-names, and date/time of file creation,last-access, & last-modification which severely increased the amount of time it took to properly analyze the contents of a folder and it's files, I decided to create an alternative.
This uses the same Windows calls as AutoIT, except it returns all the information that it rightfully should for each file found - including:
- File attributes (in numerical form, not a silly string format)
- Creation Time
- Last-Access Time
- Last-Write Time
- FileSize
- Filename (obviously)
- 8.3 short name (if it is 1. different from the regular Filename and 2. if short-names haven't been turned off
- Reparse Point info (if available)
To convert times into a readable format, you'll need to pass the array to the _FileFindExTimeConvert() function. Optionally, you can get the _WinTimeFunctions UDF and call those functions using array index constants:
$FFX_CREATION_TIME, $FFX_LAST_ACCESS_TIME, or $FFX_LAST_MODIFIED_TIME.
Note all _FileFindEx* calls are done using a special array, though 'ByRef' for quicker performance.
A nice application I found for this UDF was comparing files/folders - which is pretty easy using 64-bit filetime and file-size comparisons (no need for time conversion there).
The ZIP includes 4 files: the _FileFindEx UDF, FileFindExTest, the license agreement (same as below), and _LinkedOutputDisplay. Please note that _LinkedOutputDisplay on its own is a mess - but its included as-is to help see a side-by-side comparison of the output from FileFindExTest.
To get all the same information that _FileFindEx provides, the AutoIt functions below would need to be called:
- FileFindFirst/NextFile
- FileGetAttrib *** NOTE: This Fails to report on some attributes (Reparse Points, Sparse Files) ***
- FileGetTime *3 (one for each time - Creation, Last-Access, Last-Modified)
- FileGetSize
- FileGetShortName (note: this provides a full path, rather than just a file name)
*IMPORTANT* - Speed is severely affected on certain processors when the script is run in x64 mode. I therefore recommend running/compiling the code in both bit-modes beforehand to see what the speed difference is. On my machine I've found x86 is much faster, whereas x64 is much slower than AutoIt's search functions. Other's have different things to report, so I'm guessing it must be how optimized the hardware architecture is at running x64 code.
Update Log:
Ascend4nt's AutoIT Code License agreement:
While I provide this source code freely, if you do use the code in your projects, all I ask is that:
- If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I credit
- If the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though again if the source is provided - see #1)
- The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.
- Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.
Edited by Ascend4nt, 26 September 2011 - 05:36 AM.










