b3cf
asked on
How to grab all the files in a folder
Hi
Could someone advice me on how i could grab all the files that matches
a pattern in a folder.
ex *_tr.gif in c:\temp folder
Thanx
Could someone advice me on how i could grab all the files that matches
a pattern in a folder.
ex *_tr.gif in c:\temp folder
Thanx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SearchPattern = "c:\temp\*_tr.gif"
DestinationFile = "c:\myGIFlist.txt"
Shell(Comspec(Environ) & " /c dir " & SearchPattern & " > " & DestinationFile
These are now all listed in a text file at c:\myGIFlist.txt
--or--
similar to angelIII, you could use the pattern directly in the dir statement:
dim strFile as string
strFile = dir$("c:\temp\&_tr.gif")
while not strFile = vbnullstring
' ... do what with your file ? ...
strFile = dir$()
wend