A common problem many people face eventually is trying
to find a file buried somewhere
on their hard drive. They haven't used, or needed, the file in a while and they forget exactly
where it is. So they end up clicking on likely locations until they find it, or they use the "find"
feature of Windows. Either way can be very time consuming if you have a very large hard drive.
Wouldn't it be nice to have a printable directory of all the files in a particular folder?
You can easily do this using DOS.
The command to do this is 'tree', 'tree' in its most
basic form will provide you with the arrangement
of Folders and Sub- Folders on your drive, or within a particular folder. If you are currently in the C:,
then 'tree' will give you a list of all the folders and sub-folders on that drive. However, you can do
much more with this command by using 'switches'.
The /f switch will give you the names of the files in each folder and sub-folder directory. Your list will
show a series of lines indicating the folder structure. Some older printers may not be able to handle
the special graphics characters used--for these printers you must also add the /a switch.
In both of the above cases the results will be scrolled
on your screen--useful, but we can do better. To
send the output to a non-graphics printer we can use the redirection switch, >. The redirection switch
can also be used to send the output to a file for future reference! This file can be printed out later if desired.
The syntax to use at the Command Prompt to print a
directory listing of all files and folders within the
Windows directory is : tree c:windows /f /a >prn
If we wanted to do the same thing for all of C:, and we are already in that directory : tree /f /a >prn
If we want to save the results to a file : tree /f /a >filename.txt will save the results in the current directory.
Instead of going to the command prompt and typing in the
command and switches every time, it is useful
to make a Batch file that we can copy to whatever directory we want to index.
Making Batch files is very simple, and can be useful to
automate frequently performed tasks. Simply open
up your text editor, then type in the commands : tree /f /a >filename.txt, then save it with the bat extension.
You will see a special icon to indicate that it is a batch file if you have done it properly. Choose a filename
that is not likely to be used by any other programs--or you may overwrite something you wanted to keep!
Once you have made the batch file, simply copy/paste it in the directory you want to index, then run it.
Renaming the file with the date is a good idea if you frequently update that particular directory.