Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list the contents of a folder

Status
Not open for further replies.

buxtonicer1

Programmer
Joined
Sep 20, 2006
Messages
82
Location
GB
C:\level1\ etc...

Lets say that level1 contains a list of folders and those folders contain folders and so on...

What is the best way to get a list of all subdirectories in the level1 folder and then output those details to a file.

I would ideally like to run this at the dos prompt if possible. I know you can use the tree commmand, but can you redirect this to a file. Anyone know any other clever commands ?
 
From a CMD prompt, you can use the TREE command and output it to a file as follows:

TREE /A > DIR.TXT

The /A creates the output in Ascii format, the DIR.TXT is the text file name (this can be anything you like)

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
Are there any other commands that you know of, I mean I'll check the help menu anyway, is there an ls (UNIX) equivalent
 
Yeah, it's called "dir". You can try help dir, specially /s and /a:d options.

Cheers,
Dian
 
Actually dir /s /b /a:d could be what you're looking for.

Cheers,
Dian
 
To add to what Diancecht said... to output it to a file you'll want DIR /S /B /A:D > "filename.txt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top