[vbs] Get folder names / file names in a directory
18 February, 2011 at 5:46 pm Leave a comment
‘Option explicit
Set fs = CreateObject(“Scripting.FileSystemObject”)
‘create output file
Set outFile = fs.CreateTextFile(“d:\folder_name.txt”)
‘set directory
Set oFolder = fs.GetFolder(“d:\”)
‘if get file name use this
‘Set oFiles = oFolder.Files
‘if get folder name use this
Set oSubFolder = oFolder.SubFolders
‘go through list
For Each i In oSubFolder
‘write to output
outFile.writeline i.Name
Next
WScript.Echo “Finish!”
Entry filed under: IT/Soft.
Trackback this post | Subscribe to the comments via RSS Feed