Username Always stay logged in


Pages: [1]
Author Topic: List files in a directory to a text file  (Read 3616 times)
Pro Designer

Karma: +0/-0
Offline Offline

Posts: 219

View Profile WWW
« on: January 31, 2010, 12:35:09 PM »

In windows, go to command prompt.  To get to command prompt to to start and run, and type "cmd" and press enter.  You can do all types of cool stuff from this prompt.  

The command "dir" will list out all files and directories in the current folder.  To go back a folder simply type "cd.." and press enter.  To change drives type the drive letter followed by a colon, ex "G:", and then press enter.  To go into a directory type "cd dirname" and press enter.  To go into windows directory from C:\ at the command prompt it would go like this.

1. C:\ prompt
2. cd to windows directory and press enter
C:\> cd windows
3. you are now in the windows directory!!
To go back to C:\ just type "cd.." and press enter at the C:\Windows\ prompt

dir > list.txt
Takes all files in the directory and puts all information (size, modified, etc.) about those files into list.txt

dir /b > list.txt
Puts only the filenames for files in the directory in list.txt

dir /s /b > list.txt
Puts only the filenames for files in the directory AND subdirectories into list.txt

The file with the list will be in the directory that the command was issued.  If the command was done in the C:\Windows\> directory the file (in this case list.txt) will be in C:\Windows\.
Pages: [1]
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Greenday Theme Designed By [S.W.T]