Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page




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.

  1. 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.
  2. Need to have a copy for archival purposes of files in a certain directory.
  3. 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

  1. 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.
  2. 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.
  3. 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

  1. 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.
  2. 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.

 

 

 

 

Index


Category:
Linux Q&A
MS-DOS Q&A

Companies:
Various

Related Pages:

 

Resolved

Were you able to locate the answer to your questions?

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope