From 8c976f1e3002e31dde0961df529d4dd4ee35b5d1 Mon Sep 17 00:00:00 2001 From: Amir Szekely Date: Thu, 23 Jul 2020 11:53:08 -0700 Subject: [PATCH] Windows support `os.statvfs()` is not available on Windows so use the simpler `shutil.dis_usage()` --- bbbackup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bbbackup.py b/bbbackup.py index 574ce33..79044bc 100755 --- a/bbbackup.py +++ b/bbbackup.py @@ -256,8 +256,9 @@ def ensure_directory_exists( absolute_dir_path ): def get_fs_freespace( pathname ): "Get the free space of the filesystem containing pathname" - stat = os.statvfs( pathname ) - return stat.f_bavail * stat.f_frsize + import shutil + total, used, free = shutil.disk_usage( pathname ) + return free def sizeof_fmt(num, suffix='B'): for unit in ['','k','M','G','T','P','E','Z']: