You are not logged in.
I have a directory /foo that regularly has new subdirectories created in it. I want to create a script that will see what those subdirs are and then allow me to put their full pathnames in a variable. I can do this already, but I want to exclude /foo.
I'm sorry I can't come up with a clearer way to explain what I mean.
I'm currently using:
for DIRS in $(find /foo -type d); do echo $DIRS; done
That results in:
/foo
/foo/bar
/foo/blah
/foo/poo
/foo/zoo
(etc)
I want all of those EXCEPT the first line. How can I strip the first line out of that result?
Last edited by futuremonkey (2009-11-20 22:05:43)
Offline
Pass -mindepth 1 to find
Offline
man find; look for mindepth.
also just the find command will print the dirs, you don't need to put echo in a for loop.
/edit blurg, my rtfm was too slow...
Last edited by brisbin33 (2009-11-20 21:34:23)
//github/
Offline
Thanks, -mindepth was the thing.
I actually DID read the man page, believe it or not, and I saw mindepth/maxdepth but completely failed to understand what they meant.
Also, I intend to do something other than just print the names with the FOR loop. That was just for the sake of example.
Thanks again.
Offline