Do you want to copy all file names in a specific folder and save it as a text file? If so, you don’t need any special tools, all you need is Windows and a command prompt. How-to guide after the break.
Copying the file names in a folder is relatively easy. It can always be handy to know how to do this, you never know when you will need this. For example if you want to upload multiple files to a website, but you are too lazy to copy the file names of all pictures individually, then you will need to know this.
Anyway, let’s get started:
1. Step Open the Windows Explorer (Windows key + E)
2. Step Browse to your folder with all the files, e.g. C:\Users\[yourusername]\Pictures
3. Step Click on the address bar, select it and copy the entire address via CTRL + C (hold both)
4. Step Open up a command prompt (click on the link if you don’t know how)
5. Step Enter cd, then hold CTRL + V to insert the address that we copied into our clipboard in step 3.
6. Step Hit enter
7. Step Enter DIR /B /O:N > filenames.txt (filenames.txt is the name of the txt file)
8. StepNow open the folder where your files are stored and open the text file filenames.txt
9. Step Congratz, you have just copied all file names from a folder and stored them into a text file.
Tip:
Should you want to copy files names not only from a folder, but from sub-folders as well, you simply add a /S for subdirectories to the command: DIR /B /O:N /S > filename.txt
I am trying to get a txt file containing a list of all the mp3 files in a file on my desktop.
I typed C:/USERS/FRANK/DESKTOP/PZR MUSIC/dir/b/O:N>filenames.txt and clicked enter and it just said file path and syntax error.
I am running Windows 7 Professional for an operating system.
Peggy, I’m also on Windows 7 Professional and it works just fine here, tried it again. You have a syntax error, so you are doing something wrong.
1. There are missing spaces between the path and the command. It needs to be DIR /B /O:N > filenames.txt
2. You need to cd into the folder first, e.g. CD C:/USERS/FRANK/DESKTOP/PZR MUSIC then you can run the command above
By the way, a change of attitude might be great, instead of blaming others for your incapability. Copying file names into a text is really simple and everyone should be able to follow the tutorial, but if you don’t read it carefully you will fail.
Definitely works! I like peggy misread the tutorial and was feeling very blameful as well :P, however your comment cleared it up for me right away, was not looking forward to typing for 30 mins instead of 1. Many thanks sOliver!
Cannot copy Asian text characters, eg chinese,korean, japanese,etc except english characters.
Anywhere I can find what I wanted?
Thank you.
What if my files are in the other partition of the hard disk? It said that the system cannot find the drive specified.
I don’t get this.
I am on Windows 7 Professional (64-bit). I am trying to copy just the file names from a list of adobe PDF files. The list is on an ‘H’ drive on a network. I want to paste the file names (with no extensions) into an Excel spreadsheet.
I click on the address bar and select copy with Control + C. I open up the command prompt (DOS). The command prompt has: c:\users\Peter\>
I enter cd
I then try to paste into the command prompt (next to ‘cd’) but all it does is show ^V.
Fine. So I try with the mouse button. I right click ‘copy’ and then paste the file path into the command prompt. I hit enter.
It says: ‘CMD does not support UNC paths as current directories’.
What did I do wrong?
CTRL+V doesn’t work in DOS. type cd and then the folder to add a folder or cd.. to clear the folder. I had to handjam it in to get it to work. Since I’m doing this to make M3U files I wish someone would make a BAT file that would just do this if it was in the right folder
Hey I made a BAT file for this! That way you don’t have to mess with DOS at all.
1. Go to the folder you want to make a text file.
2. Right click and select new
3. select notepad
4. with new notepad file open type ::MyBat4Text Command will not operate anything with a double “::” at the beginning of the line. This line lets you know what the batch file will do. Press Return or Enter.
5. Type “@echo off” then press Return or Enter and type, DIR /B /O:N /S > filename.txt
6. Press Return or Enter and type “pause” then press Return
7. Save the note pad file and name it what you want
8. click on the notepad file and changed the extension from txt to bat.
9. Now any time you put this bat file in a folder and double click it it will make the text file for you (an for me I rename the text file to M3u)
More easy on Windows 7… on the Explorer over the selected files:
Shit + Right Click —> Copy As Path
Thank you! The “cd” first, and THEN paste the path… that was the trick. Thanks again!
I’ve only been searching on various forums for several week’s trying to accomplish the impossible. With your above suggestion I was able to capture 65,000+ filenames in less than 30 seconds.
Thanks for making my,what, month. I have never been here before today but now you’re on top of my list.
Bob
Thanks Bob, I suggest you subscribe or bookmark this page then with latest productivity tips:
http://windows7themes.net/category/windows-7-tweaks/productivity-tips
I’ll be writing more on this, I still know a couple more handy tricks ;)
This method needs to employ to all folder separetly. In my case I have a folder 2013 , inside these folder I have different months folder, inside each month I have date folder; inside the date I have the data files. I want to search on which date I have a particular data. For this do u have any software which Can list everything present in the 2013 (parent) folder. Then make it searchable. I need this badly. Thanks
Pankaj
Hey Man, Sorry I didn’t reead the last ‘Note’. After reading it I tried and its done :)
Your are awesome, Man!! U made my day. Thank you very much.
Hi!
I have Windows XP. I tried this but it doesn’t seem to be working for me. Could it be because the files are in a different directory, not the C directory? I have tried hitting Enter and not hitting Enter after step 7 and could not find the filenames.txt file in the folder.
This is the address of my folder. Please tell me if it is because of the different directory. G:\Corporate\Sales Support\ Image Requests\Wayfair IR 072613\jpg\primary
Thank you.
@ ekmek Thank You for the BAT file, it does exactly what I need.
I just copy/paste the bat file to wherever I want and BANG! ..file names done, and sub folders too.
FWIW: I can then tidy and or clean up any unwanted file paths in the text document at any time using the ‘Replace’ function in any text editor including Notepad.
Thanks for this great windows7themes post! :)