Category Archives: vbscript to get files

Get Files in a Folder – VBScript

Following script displays all the files present in a folder
Change the folder name in oFolder

Dim oFSO, oFile, oFolder


Set oFSO = CreateObject(“Scripting.FileSystemObject”)
Set oFolder = oFSO.GetFolder(“C:\Sample”)


For Each oFile in oFolder.Files
 MsgBox oFile.Name
Next

Advertisements