Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with file system object

Status
Not open for further replies.

bigfoot

Programmer
May 4, 1999
1,779
0
0
US
Can someone please help me with a solution...

I need to return: filename and date last modified from a folder. I ONLY WANT FILES THAT BEGIN WITH 001. My code is below:

Set FSO = New FileSystemObject
Set fFolder = FSO.GetFolder(mszServerInPath)
Set fFiles = fFolder.Files

For Each fFile In fFiles
If Left$(fFile.Name, 3) = "001" Then
debug.print fFile.Name
debug.print fFile.DateLastModified
End If
Next 'objItem

I could do a dir("001*.*") but then I can't get the date. What can I do? does fso support wildcards? I can't find any info.

Thank you so much ahead of time

-Gary

 
How about trying the following:

Code:
Set FSO = New FileSystemObject

For Each fFile In FSO.GetFolder("Folder Name").Files
  If Left$(fFile.Name, 3) = "001" Then
    debug.print fFile.Name
    debug.print fFile.DateLastModified
  End If
Next 'objItem

HTH John Whyte
jwhyte@skipton.co.uk
 
I have that.
What I wanted was to only bring back those files that begin with "001". There are about 2000 files in this folder.
It takes too long to process them all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top