Is there a way to display the progress of filecmp.dircmp in Python?

Viewed 59

I would like to have a progress bar like tqdm or progress that is changing as dircmp is comparing two directories for left_only, right_only and diff_files. Is this possible? I have tried to use tqdm with a for loop and writing them to a list but it is not showing the real progress.

dc = filecmp.dircmp(directory1, directory2)
for i, file in enumerate(tqdm(dc.left_only)):
    report.append((dc.left_only[i], "Directory1 Only")) #Files only in Directory1
for i, file in enumerate(tqdm(dc.right_only)):
    report.append((dc.right_only[i], "Directory2 Only")) #Files only in Directory2
for i, file in enumerate(tqdm(dc.diff_files)):
    report.append((dc.diff_files[i], "Different in Directory1 and Directory2")) #Files different
0 Answers
Related