Modify

Opened 17 years ago

Closed 17 years ago

#837 closed Feature Request (Completed)

FileFindFirstFile/NextFile feature request

Reported by: pdaughe Owned by: J-Paul Mesnage
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 by Valik, 17 years ago

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.

comment:2 by TicketCleanup, 17 years ago

Version: Other

Automatic ticket cleanup.

comment:3 by anonymous, 17 years ago

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 by J-Paul Mesnage, 17 years ago

Milestone: 3.3.1.0
Owner: set to J-Paul Mesnage
Resolution: Completed
Status: newclosed

Added in version: 3.3.1.0

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.