MS-Dos - List the contents of a directory in a file
It may be convenient to list the content of one or more directories in a file. Do you require a special software for this purpose? Not really!
Using a simple MS-DOS it is possible to list the content of a directory in text file.
Open the command prompt and type the following command:
You can list the content of another directory in the same text file using the >> operator:
To have the path of each files listed as well as the organization of the sub-directories, use the below command:
dir /b/s c:\mydir>myfile.txt
dir displays the contents of a directory on the screen.
The > operator indicates how to output the results of the command, in our case a text file!
To print this information directly, you can redirect the program output (stdout) to a printer, for example:
dir > lpt1
>> is a special operator which clear the current content of the output device before displaying new data.