6

I am making a script that compresses folders via shutil.make_archive, but the folders can be large, so it will take a while. Is there some sort of way I can show the percentage complete? So far I have been checking out the threading module, but I haven't found much yet

Here is an example of what I want the output to be:

ubuntu@ubuntu:~$./script foldername
Compressing foldername.zip (15%)

Here is my code so far:

#!/usr/bin/env python3
import shutil
import sys
folderName = sys.argv[1]
percent = #I don't know what to put here
shutil.make_archive("{0} Compressed".format(folderName), "zip", folderName)
print("Compressing {0}.zip ({1})".format(folderName, percent), end="\r")

You can make any changes you need to make it work

TheRealTengri
  • 1,201
  • 1
  • 7
  • 17
  • See here: https://stackoverflow.com/questions/29967487/get-progress-back-from-shutil-file-copy-thread – zvi Jul 12 '20 at 07:21

0 Answers0