To totally unlock this section you need to Log-in
Login
Sometimes, it is handy to output all the file names of a folder to a text file. This can be done in few ways; we'll use VBS and DOS.
Using VBS
Have the following code on a file named "filelister.vbs":
'INSTRUCTIONS
'filelister.vbs "c:\anyfolder"
'where filelister.vbs is this file
'and "c:\anyfolder" is the folder where the files reside
'The files will be outputted to "c:\anyfolder" and its name will be myfiles.txt
'THIS IS NOT RECURSIVE
On Error Resume Next
Dim fso, folder, files, MyFile, sFolder
Set fso = CreateObject("Scripting.FileSystemObject")
sFolder = Wscript.Arguments.Item(0)
If sFolder = "" Then
Wscript.Echo "Enter folder path!!"
Wscript.Quit
End If
Set MyFile = fso.CreateTextFile(sFolder&"\myfiles.txt", True)
Set folder = fso.GetFolder(sFolder)
Set files = folder.Files
For each folderIdx In files
MyFile.WriteLine(folderIdx.Name)
Next
MyFile.Close
To execute this, use your dos shell and type:
filelister.vbs "c:\anyfolder"
The file names will be outputted to a text file called "myfiles.txt" located on "C:\anyfolder".
Using DOS commands
Open a DOS command shell and go to "C:\anyfolder". Execute the following code:
dir /b/a-d . > myfiles.txt
The file names will be outputted to a text file called "myfiles.txt" located on "C:\anyfolder".