Community Forums Archive

Go Back

Subject:Too Many Files? Try fewer...
Posted by: D-Slam
Date:12/21/2005 11:17:24 AM

I have a script that runs fine on multiple files, but barfs when selecting 510 files. What's the upper limit on ofd.filenames? and is there a workaround to extend that?

I'm hoping to be able to run scripts on thousands of files at a time. What's the scoopage?

thx - Robby

Subject:RE: Too Many Files? Try fewer...
Reply by: _TJ
Date:12/21/2005 2:35:50 PM

the ofd.filenames limit is a limit of Windows. I believe that the upper limit is the total length of the names, so shorter filenames will allow for more files, but 500 odd is probably a pretty typical limit.

There is no workaround other than to use a different method to get the list of filenames in the first place. Or you could get a bunch of filenames from ofd.filenames, then ask the user if they want to pick more files, and show the OpenFileDialog again, then append those names onto the first list, and so on until the user says to 'no' to the 'do you want to add more files' query. (a simple MessageBox call can be used for the query).

Or you can process files by enumerating using the Directory class instead.
It's fairly simple to write a script that processes all of the files in a folder, or all of the files in a folder that match a wildcard pattern.

it's only a bit more difficult to write one that processes all of the files in a folder and all of it's subfolders.

tj

Subject:RE: Too Many Files? Try fewer...
Reply by: D-Slam
Date:12/21/2005 3:06:23 PM

Thanks. That's helpful.

Go Back