Username Always stay logged in
Password:

 

Pages: [1]
  Print  
Author Topic: List files in a directory to a text file  (Read 2773 times)
mitchell
Webmaster
Administrator
Pro Designer
*****

Karma: +0/-0
Offline Offline

Posts: 219



View Profile WWW
« on: January 31, 2010, 05:35:09 AM »

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
C:\>
2. cd to windows directory and press enter
C:\> cd windows
3. you are now in the windows directory!!
C:\Windows\>
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\.
Logged
Pages: [1]
  Print  
 
Jump to:  

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