DOS command to export the names and full paths of all files in a folder:
1. Bring up the CMD window in Windows
2. Enter in the command line: dir /s/b >>aa.txt
3. Open the text file aa.txt, and you can see a list of all file names in the folder.
4. Command parsing: /s contains subdirectories /b lists file names but does not display file information >> Output redirection.
5. DOS dir parameter reference:
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
[drive:][path][filename]
specifies the drive, directory, and/or file to list.
/A displays files with specified attributes.
Properties D Directory R Read-only files
H Hidden files A Files ready for archiving
S System files I Contentless index files
L Reparse points O Offline files
- prefix
/B for "no" Use empty format (no header information or summary) .
/C Display thousands separator in file size. It's the default value. Use /-C to
disable separator display.
/D Same as wide, but files are listed in columns.
/L Use lowercase letters.
/N New long list format with filenames on the far right.
/O List files in sorted order.
Sort order N By name (alphabetical) S By size (smallest to largest)
E By extension (alphabetical) D By date/time (first to last)
G Group directory first - reverse the order of prefix
/P in each Pause after information screen.
/Q Displays the file owner.
/R Displays the alternate data stream for the file.
/S displays files in the specified directory and all subdirectories.
/T controls the time character field displayed or used for classification.
Time period C Creation time
A Last access time
W Last written time
/W Use wide list format.
/X Displays the short name generated for non-8dot3 filenames. The format is /N format,
with the short name inserted in front of the long name. If there is no short name, a blank is displayed in its place
.
/4 displays the year as four digits
The switch can be preset in the DIRCMD environment variable.
Replace preset switches by prefixing them with - (dash) . For example, /-W.