Script that records every file name in a directory into a text document
Script that records every file name in a directory into a text document
Hello, I noticed needing to gather file names repeatedly and created a script to automate it. Shared for anyone who might need it. Download link provided: https://drive.google.com/file/d/0ByvG-UA...sp=sharing The tool includes two files—"Name Saver.bat" and "pns.exe"—placed in your target folder. Run "Name Saver.bat" and the names will appear in "names.txt" instantly. Example output shown: Finally here is the source code if you're interested: Name Saver.bat - http://puu.sh/d6PUa/4cedc6ecdb.png pns.exe - http://puu.sh/d6PS8/09b6b80890.png
Open a command prompt, navigate to the desired folder, and execute "dir /b /s >names.txt". For a quick list of switches, type "dir /?"
I often rely on this when working with sound production plugins, especially when dealing with lengthy directory paths. The "dir /b /s >names.txt" command typically fails because the directory is too long, but it usually functions correctly. EDIT - using "dir /s >names.txt" also tends to capture folder names, which isn't always desirable.
The process feels unusual in length, this hasn't happened before. The longest string I encounter is 223 characters on my system drive, with some odd .dll files scattered across multiple folders. If you don't need those folders, just include the switch "/a:-d". The command line "dir /?" works fine. For a file to run, add "/b /s /a:-d >names.txt" into a batch script and execute it.