See also:
Although this article has been included in the INport series, a print out of a list of files on your computer can be useful in situations other than a list of music titles. A printed list of movie titles, fonts, pictures, documents or any type of file can be obtained using the steps described on this web page. This "Command Prompt" procedure has been briefly described in various FAQ's and "Help" columns on the web. Since there is at least one generation of computer users that have never used DOS, a more detailed approach might be in order.
The first step is to open "Command Prompt" window. As with all things "Windows", we start with clicking the "Start" button. Once the "Start Menu" is open, Windows XP users can simply click the "Run" item in the right hand column. In the "Run box" type "cmd" into the text area labeled "Open:" and then click the "OK" button at the bottom. Those who have Windows Vista can use the customize feature of the Task Bar properties to include the "Run" command on the "Start Menu", otherwise click "All Programs" at the bottom of the left hand column and then click "Accessories". Next click "Command Prompt". If you want "administrative" privileges while using Vista's command prompt then right click this item on the accessories menu and choose "Run as administrator" on the resulting context menu.
The shorthand version of this would be:
Start > All Programs > Accessories > Command Prompt
Since DOS and/or Command Prompts have been relegated to "Legacy" status, there will be only minor differences in this procedure between Windows XP and Windows Vista. These differences are due to the directory tree structure changes made in Windows Vista. If your files are located in a directory on the main drive or are on a separate drive or partition, there will be no differences at all. The "Command Prompt" window shown here was captured from a machine running Windows Vista. Windows XP users will see on their screens C:\Documents and Settings\(your user name here)> with a blinking cursor, which is hard to catch in a screen capture. The stars in the picture represent your user name. Whether you have XP or Vista, the entire line from the starting "C" to the ending " > " is referred to as the prompt.
At this point, if you were familiar with the file structure of your drive you could type in the "dir" command its necessary switches and the "path" to the directory from which you want a printed list and reduce the length of this article considerably. Since users that are able to perform this as a one step operation are not likely to be reading this, the next step we will cover is "navigation". In navigating through the file structure of your drive the prompt will change to reflect the new current directory. The command used to change directories is "cd" or "chdir". The command requires a second part, which is always preceded by a space. Known as a parameter the second part tells the change directory command to which directory it needs to change. There is also a third part that doesn't show up on the screen although the results do and that is hitting the "Enter" key.
In this illustration, the first command line uses a change directory command with "music" as the parameter. You can see that the prompt in the second line has changed to reflect the directory change. Hopefully, you spotted the ".." following the "cd" command in the second line. This is shorthand for "parent directory". This will take you up the directory tree one step at a time until finally reaching the "root" directory "C:\" as shown in the fourth line. If, however, that is the directory you want, it is much quicker to use the third line in the illustration to get there.
Due to changes mentioned previously, Windows XP users would need to use the following:
"cd My Documents"
"cd my music"
The command parameters were shown this way to illustrate that the Command Prompt
isn't very fussy about the use of capitol letters. A mixture of upper and lower case
or all of either is fine. The two steps shown here could be combined into one step
like this "cd my documents\my music". The Command Prompt is fussy about using the
back slash "\" in path names because the forward slash "/" is used to indicate command
switches.
Command switches provide additional instructions to the command when added to the
command line. The change directory command has the "/d" switch which when used causes
the command to change the current drive as well as the current directory. If you
have your music stored on a separate drive or partition you would need to use a
command line similar to this:
"cd /d d:\music directory"
You would need to change the "d:\" in this example to match the drive letter assigned
to the drive on which your music is stored. Also match the "music directory" part
to your situation. If your target titles are located in a folder named "MP3" located
in a folder named "Rock" which is located in a folder named "Music" which is located
on drive "G:\" then your replacement command line would become
"cd /d G:\Music\Rock\MP3"
By the way, switches also require spaces between themselves and preceding elements
of the command line, in fact, it would be a safe practice to place a space between
each element in your command line. Keep in mind that "G:\Music\Rock\MP3" is the path
and as such is a single element. Spaces inside the path should only be used when spaces
are used in directory names like "My Documents". Even then the folder name would need to
be enclosed in quotes just as you see it here. As an example, moving from the current directory
G:\Music\Rock\MP3 to the "My Documents" folder would require the command line:
cd /d c:\"Documents and Settings"\UsersNameHere\"My Documents"
In this illustration, you should recognize the first command line as the change directory command using the "/d" switch to change to the "root" of the "F:\" drive. The second line is a basic introduction to the directory list command, "dir". As you can see, this command provides more information than you actually want to print on a file list. Briefly, below the command line, "F:/ > dir", are two lines starting with the word "Volume". The first line is the volume label while the second provides the drives serial number. Next is the sub-title, "Directory of F:/". The lines below this give date and time of creation, inform whether the file is a directory and on the far right provides the name of the directory/file. The last two lines of the directory report are more or less a summary.
Before continuing with the next step, it might be helpful to discuss a shortcut. Retyping the same command over and over gets old fast, fortunately there is a portion of reserved memory called a buffer that holds the last commands typed onto the command line. It can be accessed by pressing the "F3" key on your keyboard. If the last command you typed in was "dir", you can press "F3" and "dir" will appear at the new command line waiting for you to hit the "Enter" key. In fact "dir" will stay in the buffer until you type a new command, which will replace the old command in the buffer.
In this illustration, we changed the current directory to the MP3 directory and then requested a directory listing. The listing has changed to reflect the current directory change but there is still too much information here. Using the "F3" trick brought the "dir" command back to the command line. A space and the "/b" switch were added before hitting "Enter". Now you know how to get a titles only listing, however, these are still directory titles only. If you have your music organized by artist or any other of dozens of ways you will need another switch. On the other hand, those who do not attempt to organize will now have a list of music titles and only need to know how to get the list to the printer, provided of course that you don't want a neater list than what is showing on your screen.
To get the listing in sub-directories of your organized music files, you need only add the "/s" switch to your command line. From the screen capture, you can tell that this does the job of listing the individual files, unfortunately, the full path is listed to each file. Even more unfortunate is the fact that there isn't a switch available to remove the path information from the filenames. There is, however, a switch we can use to remove the listing of directories that precedes the file listings. There is also a switch you can use to alphabetize the sort. As mentioned, there isn't a magic switch to remove the full path, which is why it was suggested that you might not want to send this list to a printer. Also, there are some people that like to include album art among the files. These pictures look nice in Windows Explorer and also are shown by Windows Media Player and a few other media players as well. You may not wish to have these picture file names show up in a music list. To clean all that up a word processor comes in handy, which means we need to send the list to a text file instead of straight to the printer.
First we will want to clean things up as much as possible to save steps in the word processor. To remove the list of directories we will need to add the "/a-d" switch to the command line. The "a" part of the switch tells the system we want files with specific attributes to be listed. The "-" part of the switch means "not". The "d" part of the switch indicates directories. When put together the system understands that it isn't to list directories.
For alphabetic ordering of the list, use the "/on" switch. The "o" means "order" while the "n" represents "by name". When entered on the command line, it tells the computer to sort the list by name before it is sent to the desired output. That brings us to the next subject.
The "dir" command has a standard/default output device, the monitor screen. Fortunately,
we are able to indicate a different output when desired, by using a "redirector".
The redirector for any commands output is the ">" greater than sign and is preceded
by a space. This is accompanied by the name of the output destination. If the list
arrangement is to your liking you can send it straight to the printer by adding
" > PRN" to the end of your "dir" command line. To summarize, at this point your
command line would look similar to this:
F:\MP3 > dir /b /s /a-d /on > PRN
The exact appearance of your command line would depend on which switches you decided
to use and where your music files are located.
When opting to use a word processor for further editing, you need to redirect the
"dir" output to a text file. This is performed with " > filename.txt", where filename
represents whatever name you decide to give the file and the txt extension is needed
to open the file with your word processor. In this case, your command line would
have this appearance:
F:\MP3 > dir /b /s /a-d /on > filename.txt
Again, the exact appearance would depend on your choices and location of your files.
When redirecting the output of the "dir" command to a device, there is no question of where it is going to go. Output going to a file on a hard drive doesn't have as clear a destination, unless you are one of those familiar with DOS and Command Prompts. Not to worry, this situation was cared for long ago. The Command Prompt basically works on its current directory. All one has to do to know the location of "filename.txt" is to look at the Command Prompt. In the above example you would find your text file in the MP3 directory on drive "F:\".
Now all you need to do is open the text file with your word processor and start editing. Microsoft Word has a mechanism to make this fairly easy and I'm sure the other popular word processing programs do also. Start by highlighting one of the lines in your text file all the way up to but not including the music title. Right click this selection and choose "Copy" from the context menu. Now find the built in "replace" function of your word processor. In MS Word this is located on the "Edit" menu. When the "replace" dialog opens paste the selection you copied into the "Replace what" text box and leave the "Replace with" box empty. Next click the "Replace all" button. Using this procedure or a variation of this procedure you will soon have an alphabetized list of your music titles and you will not have worn out your backspace and/or delete keys.
Microsoft, Microsoft Office, Windows, Windows XP and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other names have been included in the above text that are trademarks of the respective companies.