Pages

Saturday, May 15, 2010

How do I print a listing of files in a directory?

Go to a MS-DOS prompt
Navigate to the directory you wish to print the contents of
Once in the directory you wish to print the contents of, type one of the below commands

dir > print.txt

The above command will take the list of all the files and all of the information about the files, including size, modified date, etc., and send that output to the print.txt file.

dir /b > print.txt

This command would print only the file names and not the file information of the files in the current directory.

dir /s /b > print.txt

This command would print only the file names of the files in the current directory and any other files in the directories in the current directory.

No comments: