API - workouts refactoring
This commit is contained in:
16
fittrackee/workouts/utils/uploads.py
Normal file
16
fittrackee/workouts/utils/uploads.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
|
||||
from fittrackee.files import get_absolute_file_path
|
||||
|
||||
|
||||
def get_upload_dir_size() -> int:
|
||||
"""
|
||||
Return upload directory size
|
||||
"""
|
||||
upload_path = get_absolute_file_path('')
|
||||
total_size = 0
|
||||
for dir_path, _, filenames in os.walk(upload_path):
|
||||
for f in filenames:
|
||||
fp = os.path.join(dir_path, f)
|
||||
total_size += os.path.getsize(fp)
|
||||
return total_size
|
||||
Reference in New Issue
Block a user