Reference number: CH000772
How do I print a listing of files in a directory?
Question:
How do I print a listing of files in a directory?
Reasoning:
You may need to create a print out, or hard
copy, of the files in a directory for any of the below reasons.
- Have a file listing of MP3 files that you wish to print out
a list of so you can have a hard copy of all your songs.
- Need to have a copy for archival purposes of files in a
certain directory.
- Want to create an online file so people can view files you
have available in a directory.
Answer:There are several different methods of printing a listing of
files; however, the method we will be using in this document is
directing or sending the output to a file so that file can be
printed, instead of directly to a printer. Because Microsoft Windows
has no easy method of printing the output of a directory to a file
and/or printer, if you're running any version of Microsoft Windows,
refer to the below "MS-DOS users" section.
MS-DOS users
Linux users
MS-DOS users
- Go to a MS-DOS prompt. Additional help and information about
how to get to a MS-DOS prompt can be found on document
CHDOS.
- Navigate to the directory you wish to print the contents of.
If you're new to MS-DOS, you will need to familiarize yourself
with the cd command and the dir
command.
- 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.
Linux users
- Navigate to the directory you wish to print the contents of.
If you're new to Linux, you will need to familiarize yourself
with the Linux cd command and the ls
command.
- Once in the directory you wish to print the contents of, type
one of the below commands.
ls > print.txt
Print each of the files and directories in the current directory
to the print.txt file.
Additional information:
- Additional information about about printing MS-DOS output to a
printer can also be found on document
CH000199.
|
|
| Resolved | Were you able to locate the answer to your questions? |
|
|