diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-03-13 20:10:06 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-03-13 20:10:06 +0000 |
commit | 14f0fee41500f28f556297f00a7ea1ee182ade83 (patch) | |
tree | 7206ef78b3a88a04089ecc73ae2bcd83217ef47c /dupfiles | |
parent | 38d306dfb99e37788632170a5d9299ca4afd99a8 (diff) | |
download | dupfiles-14f0fee41500f28f556297f00a7ea1ee182ade83.tar.gz |
Improve progress reporting for removal
Diffstat (limited to 'dupfiles')
-rwxr-xr-x | dupfiles | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -228,7 +228,15 @@ class Dupfiles(cliapp.Application): for dirname in args: dupfinder.collect(dirname) - for duplicates in dupfinder.duplicates(): + dup_sets = dupfinder.duplicates() + + self.ts = ttystatus.TerminalStatus(period=0.1) + if self.settings['remove']: + num_files = sum(len(dups) for dups in dup_sets) + self.ts['num_files'] = num_files + self.ts.format('removing %Counter(filename)/%Integer(num_files)') + + for duplicates in dup_sets: if self.settings['make-hardlinks']: self.make_hardlinks(duplicates) elif self.settings['remove']: @@ -266,12 +274,8 @@ class Dupfiles(cliapp.Application): else: keep = duplicates.pop() - ts = ttystatus.TerminalStatus(period=0.1) - ts['filenames'] = duplicates - ts.format('removing %Index(filename,filenames)') - for pathname in duplicates: - ts['filename'] = pathname + self.ts['filename'] = pathname if self.settings['no-act']: self.output.write('rm %s\n' % pathname) else: |