WeThotUWasAToad
asked on
DOS command to list both directory AND subdirectories
Hello,
I have almost no knowledge of DOS but sometime ago, an helpful EE Expert provided me with a DOS command which creates a text file of a folder's directory. The command is as follows:
Dir "C:\Users\Username\Folder name" > "C:\Users\Username\Folder name\List.txt"
I have found this command to be a great tool and have used it multiple times.
When using this command, I've noticed that when the directory contains a subfolder, the subfolder name is included in the resulting .txt file with the preceding label: <DIR>, but no subfolder contents are included.
Is there a way to modify the above DOS command so that it will display not only subfolder names but their directories as well?
Thanks
I have almost no knowledge of DOS but sometime ago, an helpful EE Expert provided me with a DOS command which creates a text file of a folder's directory. The command is as follows:
Dir "C:\Users\Username\Folder name" > "C:\Users\Username\Folder name\List.txt"
I have found this command to be a great tool and have used it multiple times.
When using this command, I've noticed that when the directory contains a subfolder, the subfolder name is included in the resulting .txt file with the preceding label: <DIR>, but no subfolder contents are included.
Is there a way to modify the above DOS command so that it will display not only subfolder names but their directories as well?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Tree command should do what you are looking for
At the command prompt enter the following
Tree > c:\tree.txt
When the execution is completed, check c:\tree.txt file
Regards
At the command prompt enter the following
Tree > c:\tree.txt
When the execution is completed, check c:\tree.txt file
Regards
To add slightly to that...
CD c:\startdir
Tree /f > c:\somewhere\lust.txt
Will show all files in the tree too.
Steve
CD c:\startdir
Tree /f > c:\somewhere\lust.txt
Will show all files in the tree too.
Steve
Hi We...Toad,
> display not only subfolder names but their directories as well
By "directories" above, I'm assuming you mean "files" (or "contents"). Just add the "/s" option. In other words:
Dir "C:\Users\Username\Folder name" /s > "C:\Users\Username\Folder name\List.txt"
Regards, Joe
> display not only subfolder names but their directories as well
By "directories" above, I'm assuming you mean "files" (or "contents"). Just add the "/s" option. In other words:
Dir "C:\Users\Username\Folder name" /s > "C:\Users\Username\Folder name\List.txt"
Regards, Joe
ASKER
Thanks for the detailed answer.
Dir "C:\Users\Username\Folder name" /s /AD > "C:\Users\Username\Folder name\List.txt"
Hope this helps!
:o)
Bartender_1