hobgoblinvasya
Board Regular
- Joined
- Jun 29, 2005
- Messages
- 215
Hi all,
as said in the subject im looking for your opinion on what is the fastest and most reliable way to list files within a folder?
what i need is to get the file name and file size and place it into 2 columns in excel. i also need to make sure that the code will not break if one of the files in the folder is being modified while the code is running. i need it to not lock up the files. and finally i need it to be fairly fast.
right now im using "Scripting.FileSystemObject",
and while it is decent enough it takes anywhere from 1m 30sec to 5+ minutes to list the same 500 files. i would definitely like to speed it up to 15-20 seconds range.
edit: forgot to mention that all files are rather small in size (<75kb), so its not a size problem.
thanks in advance !
cheers
as said in the subject im looking for your opinion on what is the fastest and most reliable way to list files within a folder?
what i need is to get the file name and file size and place it into 2 columns in excel. i also need to make sure that the code will not break if one of the files in the folder is being modified while the code is running. i need it to not lock up the files. and finally i need it to be fairly fast.
right now im using "Scripting.FileSystemObject",
Code:
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim SourceFolder
Set SourceFolder = FSO.GetFolder("MyDirectory")
'Set SourceFolder = CreateObject("Scripting.Folder")
Dim FileItem
For Each FileItem In SourceFolder.Files
'do my thing
Next FileItem
edit: forgot to mention that all files are rather small in size (<75kb), so its not a size problem.
thanks in advance !
cheers