mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-01 08:03:05 +01:00
Don't call max() in every iteration
This commit is contained in:
parent
88cfe1aad3
commit
6d66ceb7e9
@ -69,11 +69,12 @@ if __name__ == "__main__":
|
||||
)
|
||||
with TemporaryDirectory() as tmp_dir:
|
||||
dir_sizes = []
|
||||
max_dir_len = len(max(mirror_dirs, key=len))
|
||||
for dir in mirror_dirs:
|
||||
rsync_cmd = f"rsync -a -n --stats {args['-R']}/{dir}/ | grep '^Total file size' | tr -d ','"
|
||||
output = subprocess.run(rsync_cmd, shell=True, capture_output=True)
|
||||
logstr = (
|
||||
dir.rjust(len(max(mirror_dirs, key=len)))
|
||||
dir.rjust(max_dir_len)
|
||||
+ " "
|
||||
+ human_bytes(int(output.stdout.split()[3]))
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user