You've already forked ImageCompressor
mirror of
https://github.com/Llloooggg/ImageCompressor.git
synced 2026-03-06 03:26:23 +03:00
Исправлен подсчет всего размера
This commit is contained in:
@@ -54,19 +54,20 @@ def get_tool_path(name: str) -> Path:
|
|||||||
|
|
||||||
|
|
||||||
def get_folder_size(path: Path) -> int:
|
def get_folder_size(path: Path) -> int:
|
||||||
total_size = 0
|
excluded = {
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
|
||||||
for filename in filenames:
|
|
||||||
file_path = os.path.abspath(os.path.join(dirpath, filename))
|
|
||||||
if file_path in [
|
|
||||||
"image_compressor.exe",
|
"image_compressor.exe",
|
||||||
"image_compressor.py",
|
"image_compressor.py",
|
||||||
"image_compressor.db",
|
"image_compressor.db",
|
||||||
"image_compressor.db-journal",
|
"image_compressor.db-journal",
|
||||||
"image_compressor.log",
|
"image_compressor.log",
|
||||||
]:
|
}
|
||||||
|
total_size = 0
|
||||||
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
|
for filename in filenames:
|
||||||
|
if filename in excluded:
|
||||||
continue
|
continue
|
||||||
total_size += os.path.getsize(file_path)
|
file_path = Path(dirpath) / filename
|
||||||
|
total_size += file_path.stat().st_size
|
||||||
return total_size
|
return total_size
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user