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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBscript to list files in folder then send list in email

Status
Not open for further replies.

lzim

Technical User
Aug 29, 2012
1
US
Hello all,

I'm pretty new to VBscript and trying to figure out how to make a script. I need it to look in a specific folder for files, then send the list of files to an email address.

I believe I have the email portion figured out but would like input on how to perform the file checking.

THanks.
 
Here's a sample using the FileSystem Object to get you going
Code:
Dim fso, oFolder, oFile, sPath
sPath = "C:\MyFolder"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(sPath)
For Each oFile In oFolder.Files
[COLOR=#4E9A06]   '[b]oFile.Name[/b] is the file name
   '[b]oFile.Path[/b] is the full path + filename
   '[b]fso.GetBaseName(oFile.Path)[/b] is the filename w/o extension
   '[b]fso.GetExtensionName(oFile.Path)[/b] is the extension only[/color]
Next

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top