List all files on the server

Sometimes it could be useful to have a text file listing all files on your server or in a particular directory. If content is relatively static this can be used to perform a
quick file searches based on file names. Similar search using Windows search toll could take hours, whereas search inside a large text file is pretty much instant.

You can use robocopy utility to create this list:

1. Download and extract robocopy.exe. If you use Windows 7 – robocopy is already on your system.
2. Run robocopy.exe in command prompt (CMD) with following command:
robocopy.exe “\\path\to\your\folder” “TMP” /E /CREATE /TEE /LOG:FileList.txt
Basically this command will “copy” all files in “\\path\to\your\folder” and all subfolders to the folder “TMP”, however instead of copying actual files it will only create a folder structure and zero lenght files. Additionally, it will create a log file “FileList.txt” listing all “copied” files and directories.
3. Delete “TMP” directory.
If you having problem deleting “TMP” due to long file/path names, delete it in command prompt:
rmdir “\\path\to\your\folder\TMP” /Q /S


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *