Linux recursive directory listings

Note: This post is over a year old and the content may no longer be accurate.

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/*"