Created
December 30, 2010 22:09
-
-
Save virtualstaticvoid/760381 to your computer and use it in GitHub Desktop.
How to list all subdirectories of a directory in bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken from http://www.daybarr.com/blog/how-to-list-all-subdirectories-of-a-directory-in-bash | |
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 | |
view sourceprint? | |
for directory in `find . -type d -maxdepth 1 -mindepth 1 -not -name .svn` | |
do | |
echo $directory exists here - do something with it | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment