Nov 8, 2009

Showing All Folders On Unix

free web hosting
Open Discussion & Free Web Hosting > General Discussion > Computer Talk

Showing All Folders On Unix

toby
I want to get the name of every folder but not any files in one volume, on Mac OSX 10.5.6. The best idea I can think of is some mix of ls/find and grep/awk, but even with google and man I can't work much out. I got to ls -Rl and awk '{ print $NF }' > file but they don't work together well. Any ideas? It can be a program, I just looked for unix commands first.

Comment/Reply (w/o sign-up)

yordan
If it's pure Unix or Linux, I would try the following :
CODE
find . -type d -print

"find" will look for everything starting from the current position (".") in order to display it ("-print"), provided that it's type ("-type") is "d" (directory).
I just tried it on my Unix system and it works fine.

Comment/Reply (w/o sign-up)

toby
Ty, perfect. I shall learn about find, it's new to me.

Comment/Reply (w/o sign-up)

yordan
QUOTE (toby @ Feb 19 2009, 05:53 PM) *
Ty, perfect. I shall learn about find, it's new to me.

I use "find" very often.
for instance, if you want to perform a backup of a given folder and put it on your tape, you use find this way :
CODE
find . -print |cpio -omBdv >/dev/rmt0

And if you want to copy the whole content of your folder to the remote resource which is nfs-mount on /mnt, use the following :
CODE
find . -print |cpio -pmdulv /mnt/myfolder

Which means that you have to simultaneously learn "find" and "cpio" syntax... laugh.gif

 

 

 


Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)


See Also,

*SIMILAR VIDEOS*
Searching Video's for Showing, All, Folders, On, Unix
advertisement



Showing All Folders On Unix

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com