diff --git a/backup.py b/backup.py index bbef16f..f0281fb 100755 --- a/backup.py +++ b/backup.py @@ -140,6 +140,7 @@ class Backup: st = os.lstat(path) is_dir = stat.S_ISDIR(st.st_mode) is_reg = stat.S_ISREG(st.st_mode) + size = st.st_blocks * 512 # Decorated path ends with a '/' if it's a directory. decorated_path = path @@ -160,14 +161,14 @@ class Backup: # Crosses a mount point exclude_reason = ('I', "skipping, on different filesystem") - elif (self.config.max_file_size - and is_reg - and (st.st_blocks * 512) > self.config.max_file_size): + elif (is_reg + and self.config.max_file_size + and size > self.config.max_file_size): # Too big def format_size(n): return humanfriendly.format_size( n, keep_width=True, binary=True) - a = format_size(st.st_blocks * 512) + a = format_size(size) b = format_size(self.config.max_file_size) exclude_reason = ('W', f"file size {a} exceeds limit {b}")