Make DOS Print List of Files In a Folder, Get Filenames in .TXT File

If you are a programmer or developer sometimes you might want to list all file names in an excel sheet from particular directory, folder in your computer. Copying each and every filename separately is big hassle and the process becomes more tedious as the number of files in that directory increases which makes it almost impossible to manually get filenames of files in a folder.

If you are a windows user then its possible to list all the filenames of a folder into a text file. And for that purpose, you won’t have to install any extra application, you can do it directly with Windows Command Prompt (DOS).

Print List of Files In a Folder into a .TXT File Using CMD-DOS


Step 1: Open Command DOS Prompt in administrator mode. Click on Start button / orb in Windows 7, Vista and type "cmd" in the search box. The command prompt appears in the list as cmd.exe. Now, right-click on it and select "Run as administrator".



Windows XP users can open command prompt by simply typing cmd in the Run window (Win + R).

Step 2: In the command prompt, type cd\ and hit Enter to go to root. Then the command you must execute to print the list of file names is:
dir [folder_location] /b >[output_file_name.txt]

Let us describe the command by an example. If you want to print the file name of the folder Assignment and if the full path location of that folder let beD:\important\documents\Assignment, then the command to print the file names should be as below:

Make sure that you have given the full path of the source. The output file will be created in the root drive where the command prompt is running. In this case, my Windows drive is assigned as C:, so the files is created as C:\chart.txt.

The output file, here it is chart.txt is a text file which opens with Notepad in Windows system by default. So whenever you need to use the name of the content of a folder in any application or want to print them, you can easily do that by the above procedure.

Suppose you want to place all the file name from a specific folder into a Microsoft Excel file. Just create the list of file name and open it. Press Ctrl+A to select them all and copy (Ctrl+c) then go to excel and paste (Ctrl+v). The files name will be automatically added one-by-one in separate cells.

Software, Tools to Get List of Files in a Folder in Windows

If you don’t like DOS then check out Karen’s Directory Printer (Link) which can print the name of every file on a drive or folder, along with the file’s size, date and time of last modification, and attributes (Read-Only, Hidden, System and Archive).



The list of files can also be sorted by name, size, date created, date last modified, or date of last access.
You can also try GetFolderSize (Link) which can display the total file size and the number of files and subfolders in the folder an also save that list of files with many advanced options.


1 komentar:

  1. I use Directory Report
    http://www.file-utilities.com
    It can print more attributes than the dir command

    ReplyDelete

 
Copyright © INFO BLOGBEGO

Template by Blogger templates
Powered by Blogger