1.

Solve : LS / FIND newbie help-directories w/out filenames??

Answer»

I'm trying to get the syntax for either "ls" or "find" or some other unix command that will give me a list of directories and all subdirectories, without any filenames.

I tried
Code: [Select]ls -R | bbeditwhich gave me a great listing of all files and directories PIPED to a bbedit document. I'm trying to find the command that will give me just the directories and subdirectories, without the actual filenames. Anyone, anyone???

TIAfind is certainly a good candidate for this. Depending on your installation, info find or man find will tell you all you need to know. ALTERNATIVELY, here's a one-liner which uses ls, grep and sed (not written by me):

Code: [Select]ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'Holy command-line Batman! That worked E-X-A-C-T-L-Y

Thanks VERY MUCH!
You're welcome. Please tell me I wasn't just suckered into answering a homework question. Quote

....
I'm trying to find the command that will give me just the directories and subdirectories, without the actual filenames. Anyone, anyone???
TIA
generally for FINDING only directories , this will be the command...
Code: [Select]find /dir -type d
No Rob, no worries there.

Personal use only on the ls command. I have a very large music COLLECTION and I never have been able to print out a directory listing...until now.

Weird though - I now realize that's something else I'll have to monitor with my kids: homework answers from internet FORUMS. Just great, something else to watch out for....

Thanks again.Yep, the internet is a great... er... research tool. It's also teeming with idiots and villains. Proceed with caution!


Discussion

No Comment Found