Windows might have some fancy tricks up its sleeve, but easily generating a list of files in a given directory isn't one of them. For that, your best bet is heading back to a good old-fashioned DOS prompt.
It's not an uncommon scenario: you want a list of all the documents or photos or music files in a given directory, but not the actual files themselves. Windows will happily show you the file names (in Explorer/My Documents/My Pictures — the label varies depending which version of Windows you use and which shortcut you pick); let you choose which order to sort them in; attach them to an email or compress them into a ZIP file. But within Explorer, it won't actually give you an list of files you can throw in an email or edit (other than taking a screen shot, which isn't very helpful).
Fortunately, there is a simple way of doing this, buried within the DOS command line which Windows has always offered. These days, there's relatively little actual DOS code in the guts of Windows Vista or 7, but the command line remains available. While it's often favoured by keyboard gurus for quite complex tasks, producing a file list is one useful trick even for people who are otherwise very happy in a drag-and-drop universe.
The following is a step-by-step guide to doing this, which assumes that you don't know anything much about DOS commands or the like. Experienced command line users could doubtless use slightly different (and speedier) techniques to get the same result, but this method has the advantage of not requiring that detailed knowledge.
- Navigate to the directory you want to list the files from (using My Documents or Windows Explorer.)
- Right-click on the end of the directory name and select 'Copy Address'.
- Click on the Start button.
- In the Search box, type cmd and then click OK or hit Enter. This should launch the command prompt, a window with a black background and a cursor waiting for you to type commands. (You can also type cmd into the Run dialog on older Windows versions for the same result.)
- Type cd and hit the space bar.
- Right-click next to this with your mouse and select Paste. This will add your previously-copied directory name to the command. Hit the Enter key. This will move you to the directory you're interested in.
- Update: Commenter David points out below that in Vista there's a faster way to open a command prompt in your chosen directory: hold down Shift, right-click the directory, and select 'Open Command Windows Here'. This lets you skip the first six steps above.
- To create a basic list of all the files in this directory in a file called list.txt, type this command and hit Enter: dir *.* /b >list.txt
- To restrict the list to files of a particular type, change the second asterisk (*) to the file type. For instance, this command will only list MP3 files: dir *.mp3 /b >list.txt
- Close the command window by clicking on the X in the top-right corner.
- There will now be a file called list.txt in your original directory, containing the names of all the files in that directory, which you can open, copy and edit.
Got your own tactic for building file lists? Share it in the comments.
Lifehacker 101 is a weekly feature covering fundamental techniques that Lifehacker constantly refers to, explaining them step-by-step. Hey, we were all newbies once, right?