How can I export a directory structure in Windows?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5 Looping
--
Chapters
00:00 How Can I Export A Directory Structure In Windows?
00:33 Accepted Answer Score 92
01:12 Answer 2 Score 10
01:44 Answer 3 Score 21
02:09 Answer 4 Score 12
02:16 Thank you
--
Full question
https://superuser.com/questions/258287/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #directorylisting
#avk47
ACCEPTED ANSWER
Score 92
Assuming your directory tree is of reasonable size, you could also use the built in tree
command, which produces a rather pretty looking directory tree. Unfortunately this prettiness is difficult to get working outside of a cmd instance, so you'll probably want to tell it to just use ascii characters with the /A
switch.
Example:
From a small multi-level structure
+---A
| +---A
| \---B
+---B
| \---A
| \---A
\---C
You can then redirect this to a file using a command like:
tree /A ["directory path"] > tree.txt
Where the directory path is optional, but useful if you want to tree something which isn't the current working directory.
ANSWER 2
Score 21
If you want to use powershell the code is very simple and the output is nice.
Code:
Get-ChildItem | tree
With
Get-ChildItem | tree > foo.txt
you can pipe the output to a Textfile.
Example Output:
Auflistung der Ordnerpfade für Volume System
Volumeseriennummer : 48E9-F43B
C:.
├───Contacts
├───Desktop
├───Downloads
│ └───Evernote Import
├───Dropbox
│ ├───Apps
│ │ └───iftttcom
│ │ └───getpocketpdf
│ ├───Backup
│ ├───Camera Uploads
│ ├───Development
ANSWER 3
Score 12
You can also put the results directly into the clipboard (in Vista+):
tree | clip
ANSWER 4
Score 10
While you most likely want the output of the TREE
command (e.g. TREE /F > output.txt
) in this case, if raw text as the output is fine, then you can run the following from a command prompt:
DIR C:\ /S > output.txt
Where output.txt will be generated in the current working directory, and contain a listing of all files and directories on the C:
drive. If you want just an output of files with their full paths, run the following:
DIR C:\ /B /S > output.txt
It would also be a trivial task to write a program to parse the output back into a directory view style program for you to view.