Archive for 18 February, 2011

[vbs] Get folder names / file names in a directory

‘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!”

18 February, 2011 at 5:46 pm Leave a comment


February 2011
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28