Opened 16 years ago
Closed 16 years ago
#837 closed Feature Request (Completed)
FileFindFirstFile/NextFile feature request
Reported by: | pdaughe | Owned by: | Jpm |
---|---|---|---|
Milestone: | 3.3.1.0 | Component: | AutoIt |
Version: | Severity: | None | |
Keywords: | FileFind | Cc: |
Description
FileFindFirstFile/NextFile do not currently set @extended.
If no error occurs (@error = 0), @extended could be set equal to the file attributes from the WIN32_FIND_DATA structure, or minimally to values to indicate whether the returned name is a directory or file.
This enhancement would eliminate the need to use FileGetAttrib, as is typically done (e.g. _FileListToArray UDF), thus providing a significant performance improvement (8 to 10 times faster on directories with over 1000 entries).
Summary: Enhanced performance for what may be a non-substantial programming effort.
Attachments (0)
Change History (4)
comment:1 Changed 16 years ago by Valik
comment:3 Changed 16 years ago by anonymous
Actually, I like your idea of using @extended to return 1 if a directory or 0 otherwise. It seems no matter what one is interested in, it must first be determined if it's a file or directory.
I modified _FileListToArray, replacing the FileExists test with a DirGetSize, and then getting the file attributes only if indeed the path has subfolders. A very minor hit (DirGetSize is really fast) if the path does have folders, if not, it's twenty (20) times faster for a folder with only 500 files. I just like to see AutoIt knock the socks off the other scripting languages. :)
comment:4 Changed 16 years ago by Jpm
- Milestone set to 3.3.1.0
- Owner set to Jpm
- Resolution set to Completed
- Status changed from new to closed
Added in version: 3.3.1.0
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
It's a good request but there are two problems which build off one another. First, we could certainly return the numeric dwFileAttributes data via @extended but we shouldn't. It's a different way to get the same data FileGetAttrib() does but it's returned in a completely different format. That makes it inconsistent which is bad. The second problem is we can't convert it to a string like with FileGetAttrib() because @extended can only be a number. This could certainly be changed but then it would come with a much larger performance impact. Finally, an unrelated argument would be, "why file attributes"? I may be just as interested in getting the size as you are in getting the attributes so I may want that instead. Or the time could be returned as seconds since epoch.
I'm not sure about using @extended to just return 1 if a directory and 0 otherwise.