List all files and folders in a certain directory with Terminal

ALL files and ALL folders

For a text file of ALL files and Folders in your Home Directory,

In Terminal, enter:
find ~ -print | sed -e 's;[^/]*/;|--->;g;s;--->|; |;g' > ~/Desktop/Tree.txt

To direct to a specific Folder, replace ~ with the Directory (i.e. find ~/Documents):
find ~/Documents -print | sed -e 's;[^/]*/;|--->;g;s;--->|; |;g' > ~/Desktop/Tree.txt

NO files and ALL folders

Before -print add
-type d
Leave spaces around it.

Listings from mounted devices

find mount/Volumes/path/to/dir -type d -print | sed -e 's;[^/]*/;|--->;g;s;--->|; |;g' > ~/Desktop/Tree.txt

source: discussions.apple.com

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.