Quick tip: Finding subfolders

When organizing folders it can be needed to find out if and which folder has subfolders.

Let’s say we have the following folder layout:

- disk1
- - subfolder1
- - subfolder2
- disk 2
- - subfolder3
- disk 3

Finding the folders which has subfolders is pretty easy:

find . -mindepth 2 -type d

Adjust the mindepth parameter to your needs. In the given case, it outputs:


Leave a Reply

Your email address will not be published. Required fields are marked *