Does anyone know in what order files are processed if using a for each container and file enumerator? Does it sort files alphabetically and loop through? Or use a date time stamp? Or something else? I need files to be processed in a certain order, and the ordering is in the filename, so the foreach file enumerator sorts on filename, then I'm ok, otherwise I need to figure something else out. Thanks.
alphabetically. But then you could always test it out on your side.|||The sort order on this is not guaranteed (unless something has changed since the last time I researched it). As Phil mentioned, it typically does return results alphabetically, but it is not guaranteed to always return them that way. If ordering is critical, you should check out this post for some options and some script for sorting files: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1460241&SiteID=1|||
I bet that whatever API the enumerator uses, ends with calling this Win32 function:
http://msdn2.microsoft.com/en-us/library/aa364418.aspx
The documentation for which says:
The order in which the search returns the files, such as alphabetical order, is not guaranteed, and is dependent on the file system. You cannot depend on any specific ordering behavior. If the data must be sorted, you must do the ordering yourself after obtaining all the results.
No comments:
Post a Comment