added rethash parameter to iter_file_dups
This commit is contained in:
parent
609418975e
commit
a60ede31fb
1 changed files with 9 additions and 4 deletions
|
@ -103,11 +103,16 @@ def mv_file_dups(topdirs=['./'], hashalg='md5', block_size=4096,
|
||||||
shutil.move(f, dest_dir)
|
shutil.move(f, dest_dir)
|
||||||
|
|
||||||
|
|
||||||
def iter_file_dups(topdirs=['./'], hashalg='md5', block_size=4096):
|
def iter_file_dups(topdirs=['./'], rethash=False, hashalg='md5', block_size=4096):
|
||||||
"""Yield list of duplicate files when found in specified directory list.
|
"""Yield duplicate files when found in specified directory list.
|
||||||
|
If rethash is True then tuple hash value and duplicate paths list is
|
||||||
|
returned, otherwise duplicate paths list is returned.
|
||||||
"""
|
"""
|
||||||
dups = file_dups(topdirs, hashalg, block_size)
|
dups = file_dups(topdirs, hashalg, block_size)
|
||||||
for fpaths in dups.itervalues():
|
for hash, fpaths in _dict_iter_items:
|
||||||
|
if rethash:
|
||||||
|
yield (hash, fpaths)
|
||||||
|
else:
|
||||||
yield fpaths
|
yield fpaths
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue