How to Copy Filenames from Folder to Excel, Text or Word File

Have you ever felt this need ? Today i was preparing a database of files in a folder in an Excel Sheet. It is a hectic job if i right click on each file, go to rename, copy its file name and then paste it in excel. I found an easier way to do it. This trick will work on Windows platform by using command prompt.Follow the following steps to copy filenames from a folder to a text file:
  • Copy the folder to C Drive. However it can be done in any folder but as now we will work in DOS and it will be easier to write a shorter path.
  • Run DOS (Command Prompt). You can do it by typing "cmd" in Run.
  • Now type the following command
              dir "C:\folder_name" > C:\folder_name\output.txt /b /o   
  • Now Close DOS (Command Prompt).
  • Go to the folder. There you will find a next file in it named "output.txt". Open it. It will have a complete list of files present in that folder (including output.txt).
Now you can use the content in that text file anywhere you need. You can paste it in excel. Each filename will be pasted in next cell. You can easily use this information in Word file as well and any text editing software.
If you need complete file names including path then you can also do it using some text editing softwares or excel. I am big fan of MS Excel and like to play with it. However there are ways to get filenames (including path) in a folder using command prompt. Will Get it for you very soon. 
Share this Article :
Email

No comments:

Post a Comment