Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


List Files in a directory

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,352
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> List Files in a directory
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 List Files in a directory - 8/21/2001 12:06:26 PM   
  swell9

 

Posts: 2
Score: 0
Joined: 8/21/2001
From: USA
Status: offline
How would I list all files within a specific directory ? Also, how would I list all the files with a file name that contains the letters wlf ?

I'd appreciate any help.
 
 
Post #: 1
 
 Re: List Files in a directory - 8/21/2001 12:20:54 PM   
  swell9

 

Posts: 2
Score: 0
Joined: 8/21/2001
From: USA
Status: offline
This is in vbscript.

How would I list all files within a specific directory ? Also, how would I list all the files with a file name that contains the letters wlf ?

I'd appreciate any help.



[/quote]

(in reply to swell9)
 
 
Post #: 2
 
 Re: List Files in a directory - 8/29/2001 11:16:11 AM   
  imav8n

 

Posts: 95
Score: 0
Joined: 7/3/2001
From: USA
Status: offline
Use the File System Object.

Try this:

Set filesys = CreateObject("Scripting.FileSystemObject")
filepath = filesys.GetAbsolutePathName("c:")

Set TargetFolder = filesys.GetFolder(filepath & "\FolderName\")

Set FolderFiles = TargetFolder.Files

For each targetfile in FolderFiles
wscript.echo targetfile.name
next

For more information, try these links:
http://msdn.microsoft.com/scripting/default.htm?/scripting/vbscript/

or

http://www.devguru.com/

There are many other good sites out there too...these are just my personal favorites.


~imav8n

(in reply to swell9)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> List Files in a directory Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts