MousePotatoPower


Get an Editable List of Files from Vista (or XP)

Posted in Personal Productivity, Tweaks by David Dugay on the 05.12.2008.6.51.43

Recently, I needed a list of files in a specific directory on my computer. The list has to be editable so that I can sort it and search through it. There are tons of small utilities available online that claim to print a list of files from a folder/directory in Vista, many of them will create a text file (which is what I want). Some are free, some cost money, all of them can be downloaded from websites that I don’t trust.

Microsoft’s own Knowledgebase article doesn’t work with Vista, so I spent part of my evening searching for a free way to print a directory listing in Vista.

  1. Navigate to the folder you want, but do NOT enter the folder
  2. hold the shift key down and right-click on your desired folder
  3. select Open Command Window Here (vista) or Command Prompt (XP)
  4. in the Command Window type: dir /b > someFilename.txt
  5. hit Enter to make your file listing
  6. type exit to close the Command Window

Look in your desired folder, a new file called someFilename.txt will be there. It will contain a list of all the files in the same folder.

Let’s explain.

dir is an old-school DOS command called directory. It generates a list of files and directories and displays it on the screen.

/b is an optional switch that tells dir to use a bare format with minimal information. Switches customize the output of dir. Here’s a few other switches to use with our dir command:

  • dir > filename.txt - this is the default format that dir gives
  • dir /on > filename.txt -”/o” specifies a sort order, “n” makes it sort alphabetically

If you feel like you need to experiment more, techrepublic.com.com (no, that’s not a typo) has a pretty good article on Dir command options.

The greater than sign “>” redirects the results of dir to somewhere else. In this case, into a file called someFilename.txt

Leave a Reply

You must be logged in to post a comment.