Wednesday, June 1, 2011

Listing those files

Occasionally it is useful to take a list of files from a windows directory and list them in an Excel spreadsheet or bring them into a SQL database. One use may be a directory full of pictures that you would like to build into your webserver database. Keying those file names is time consuming and there is no way to copy and paste them from a file folder into a database or spreadsheet.

The only alternative is to turn to your CMD window. I know, I hate it too. But it does simplify things and save time in the process. Here's how to create a list in Windows 7:

  1. Click on your start button and in the search box type CMD.
  2. Navigate to the folder where you want to create the list.
    • Open the folder in windows where your to be listed files are.
    • Click on the address bar and then click copy address.
    • In the black CMD  window type cd and then paste your address into the window and press enter.
  3. Create a text file of your directory listing only file names:
    • key: dir /b>textfile.txt press enter
  4. Your file should be created in the same directory/window
Windows will not allow you to save a file in your drive's root directory ie: directly to your "c" drive so you'll have to create a folder and direct the textfile to be saved into the newly created folder.

There are many options that you can pull from the "dir" command. View all the options available by typing dir/? in the black command window.

No comments:

Post a Comment