import osdef func(filepath, n): file = os.listdir(filepath) for f in file: file_p = os.path.join(filepath, f) if os.path.isdir(file_p): print("\t"* n, f , ":") func(file_p, n+1 ) else: print("\t"* n ,f) passfunc("g:/salar", 0 )