Copy all File Names in Folder to Excel


Print Post

Do you work with a lot of files? I do. And it’s hard and tedious to keep everything organized. Currently we’re transcribing over 200 files for a client and an easy way to keep tabs on each file  is to copy all the file names into an Excel sheet and use that to keep tabs of the files as they go through our workflow.

With over 200 files, it’s very tedious to copy and paste each filename into an Excel sheet. Fortunately there is an easy way to copy all file names in a folder using MS DOS. Why would you want to use MS DOS? If you’re as old as I am: nostalgia.  It takes me back to the days of 5 ¼ and 3 ½ floppy disks. The good old days. Enough of that, he’s what you need to do.

Step 1: Open Command Prompt

Go to start-accessories and you’ll find Command Prompt. There are other (easier?) ways to access command prompt, for instance using the run command. But you’ll find command prompt in your accessories folder regardless of the Windows Operating System you are using.

Step 2: Navigate to the folder

Using DOS command, navigate to the folder you wish to copy all of the filenames. This is probably the most difficult part for a novice. When you execute Command Prompt, also known as CMD, you get a black blank screen with something like this:

C:\Users\[you]>

To go to a folder (directory) we use CD command, so:

C:\Users\[you]> CD [folderpath]

Example:

C:\Users\iman> CD C:\iman\music and press enter…will take you to the music folder in the iman folder.

If you want to move to a folder in another drive, for instance F drive, first navigate to the file by typing the drive letter plus colon, so:

C:\Users\[you]> F:  navigates you to the F: drive.

Step 3: Type the following command

DIR  > [filename.xls]

Example:

C:\Users\ DIR > list.xls  …saves all the names of the files in users folder into an Excel spreadsheet named “list” in the Users (parent) folder. You can change the .xls extension to .txt or .doc and the command will save the file into a Notepad and Word documents respectively.   There are a number of attributes that you can add to the DIR command to suite your preferences. For instance, if you need just the only the filenames you can use:

DIR/B  > [filename.xls]

You can sort the filenames alphabetically:

DIR/B/O:N  > [filename.xls]

And include all the names of the files in subfolders:

DIR/B/O:N/S  > [filename.xls]

Remove the directory path:

DIR/B/A-D/ O:N/S  > [filename.xls]

Finally save the Excel file to different folder:

DIR/B/A-D/ O:N/S  > [folderpath\filename.xls]

Here is a list of attributes you can use:

/A      Displays all files with specified attributes.

attribs   D  Directories   R  Read-only files         H  Hidden files

S  System files  A  Files ready to archive  -  Prefix meaning “not”

Several attributes may be combined e.g. /A:HD-R

/O      Lists files in sorted order.

N  By name (alphabetic)       S  By size (smallest first)

E  By extension (alphabetic)  D  By date & time (earliest first)

G  Group directories first    -  Prefix to reverse order

Several attributes may be combined e.g. /O:GEN-D

/S      Displays files in specified directory and all subdirectories.

/B      Uses bare format (no heading information or summary).

/L      Uses lowercase.

Was this helpful?
If you like this post please recommend it on Facebook!


Comments

  • moncler scontati

    Thank you very much. This really helped me with my work. I appreciate your help. Thanks a lot.

    • Johny B

      very much helpful.. thnx a lot :)

  • Anil Pandey

    Really great thing dear. You are awesom.

    BR
    Anil Pandey

    • My pleasure Anil, glad you found the post useful.
      All the best.

  • Vivek

    Thanks for the wondferful post…Saved hours for me …

    • Thanks Vivek, always a pleasure.

Leave a reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>