Jump to content
xisto Community
toby

Showing All Folders On Unix

Recommended Posts

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.

Edited by toby (see edit history)

Share this post


Link to post
Share on other sites

If it's pure Unix or Linux, I would try the following :

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.

Share this post


Link to post
Share on other sites

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 :
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 :
find . -print |cpio -pmdulv /mnt/myfolder
Which means that you have to simultaneously learn "find" and "cpio" syntax... :mellow:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.