#!/usr/bin/env python3 import os curr_pwd = os.getcwd() cont_dir = os.scandir(curr_pwd) with os.scandir(curr_pwd) as it: for entry in it: if not entry.name.startswith('.') and entry.is_dir(): # check if directory contains a .git subdirectory with os.scandir(entry.name) as folder: #print(folder) for foobar in folder: print("debug: " + foobar.name) #print(entry.name) # chdir(path)