Linux recursive directory listings

It’s sometimes really useful to recursively generate a list of directories, excluding the files.

I use this in build scripts to create lists of directories that will need to be generated on the remote server – this is useful for things like upload directories for user generated content that wouldn’t necessarily be under version control.

 
find . -type d

To exclude a directory within this path you can use:

 
find . -type d -not -path "./directory_to_ignore/*"

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>