import os
full_path = '/home/nihi1ist/some_folder'
ignored_names = {'.git', '.gitignore', '.idea', 'venv'}
folder_files_size, subfolders_count, files_count = 0, 0, 0
for root, dirs, files in os.walk(full_path, topdown=True, followlinks=False):
folder_files_size += os.path.getsize(root)
root_name = os.path.basename(root)
if root_name not in ignored_names:
for element in dirs:
if element not in ignored_names:
path = os.path.join(root, element)
print('Это каталог:', path)
subfolders_count += 1
folder_files_size += os.path.getsize(path)
for element in files:
if element not in ignored_names:
path = os.path.join(root, element)
print('\tЭто файл:', path)
files_count += 1
folder_files_size += os.path.getsize(path)