I often want to copy all the file names with full path and extensions in a folder to a ".txt" document but can't. Is there an easy way to do this? How? Is there a simple batch file that will do it? Freeware might work, but I would rather have a simple batch.bat or .exe file that works.
Open up a command prompt
Navigate to the directory you want with
dir /B > filelist.txt
Open filelist.txt or move it where you want.
C:\Users\Tom\Documents>dir /B all.css BFBC2 Disc Images Fax Fiddler2 gegl-0.0 Network Monitor 3 Scanned Documents SQL Server Management Studio SweetScape Virtual Machines Visual Studio 2010
You can limit to just files with
dir /B /A-D. /AD meaning only directories, /A-D means not directories.
(for %F in (*) do @echo %~dpnxF)|sort >filelist.txt will produce sorted list of files (with full paths) in current directory in file called
* to whatever directory\path pattern you wish. Be aware that it will include
filelist.txt itself if you enumerate current directory so it's better to run from parent dir instead.
In Windows 7 and later, it's so easy!
(You don't need special tools or even the command prompt.)
- Using Windows Explorer, select whichever files you want
- Shift+Right-Click (will make "Copy as path" available in the context menu)
- Click "Copy as path"
- Paste to Notepad (or wherever else you want)