from glob import iglob level3 = iglob('/home/backups/mysql/*/*/*') level3_dirs = [x for x in level3 if os.path.isdir(x)]