Wednesday, July 05, 2006

How to create a list of files in a directory, using VB Script. Find the sample code below..


On Error Resume NextDim fso, folder, files, NewsFile,sFolder
Set fso =
CreateObject("Scripting.FileSystemObject")
sFolder = Wscript.Arguments.Item(0)
If sFolder = "" Then
Wscript.Echo "No Folder parameter was passed"
Wscript.Quit
End If
Set NewFile = fso.CreateTextFile(sFolder&"\FileList.txt", True)
Set folder = fso.GetFolder(sFolder)
Set files = folder.Files
For each folderIdx In files
NewFile.WriteLine(folderIdx.Name)
Next
NewFile.Close




PHP, DHTML, C, C++ and many more languages,
for help visit Programming Fourm

No comments: