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:

data
 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:

./disk2/subfolder3
./disk1/subfolder2
./disk1/subfolder1