Академический Документы
Профессиональный Документы
Культура Документы
Introduction
If you have ever wanted to make a list of all the files contained in a particular folder, you
will have discovered that the Windows Explorer interface provides no easy way to do this. It
is very straightforward, however, when using the command line. Furthermore, the
command line provides a simple way to list all the files of a certain type- for example, all
your MP3 files. The method uses the directory or "dir" command. This command will be old
news to many but it remains one of the most useful for average PC users.
List on the screen all the files in a given folder and its subfolders
Open the command line at the folder of interest (see previous tip).
Enter “dir” (without quotes) to list the files and folders contained in the folder.
If you want to list the files in all the subfolders as well as the main folder, enter “dir /s”
(without quotes) instead.
The lists can be quite long and the screen is often not where you want the list displayed.
Fortunately, creating a file containing the list is very easy.
The output can be sent to a text file by using the redirection symbol “>” (no quotes).
The file "listmyfolder.txt" will be created automatically in the working folder. (Of course, you
can use any name you choose but it is best to keep the extension .txt.) The list can be kept
for reference and printed if desired. The list does not have to be placed in the working
folder. Give the full pathname to create the file elsewhere. For example, “dir
>F:\listmyfolder.txt” could be used to place the list on an external drive F:
Rather than listing all the files in a folder, you may desire a list of certain types such as
pictures or music. The dir command allows the use of the wildcard symbol *, which adds
very useful functionality. Here are some examples.
A simpler format
The commands as written will make lists that include information about files such as size
and date of creation. A simpler list containing only file names (with full path) can be
obtained with the switch "/b". An example command would be:
Get your own favorite tip published! Know a neat tech tip or trick? Then why not have
it published here and receive full credit? Click here to tell us your tip.
This tips section is maintained by Vic Laurie. Vic runs a Windows blog called The PC
Informant
Click here for more items like this. Better still, get Tech Tips delivered via your RSS feeder