To (non-recursively) list all children of a directory in bash
find . -type d -maxdepth 1 -mindepth 1
and to do the same but omitting the .svn directory (subversion's working copy info)
find . -type d -maxdepth 1 -mindepth 1 -not -name .svn
Useful in constructs such as
for directory in `find . -type d -maxdepth 1 -mindepth 1 -not -name .svn` do echo $directory exists here - do something with it done
Had to write it down as I just had to figure it out again. I'll know where to look next time.
Leave a comment