Как проверить все файлы и паки в директории?

Вот код:

import os
import send2trash

os.chdir('E:\\test')
for text, dirs, files in os.walk('E:\\test'):
    for size_dir in dirs:
        if os.path.getsize(size_dir) > 52428800:
            print(os.path.abspath(size_dir))
            send2trash.send2trash(size_dir)
        else:
            pass
    for size_file in files:
        if os.path.getsize(size_file) > 52428800:
            print(os.path.abspath(size_file))
            send2trash.send2trash(size_file)
        else:
            pass

Ошибка:

Traceback (most recent call last):
  File "test2.py", line 7, in <module>
    if os.path.getsize(size_dir) > 52428800:
  File "C:\Users\Назар\AppData\Local\Programs\Python\Python38-32\lib\genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'calculator'

Ответы (0 шт):