The while condition is unnecessary.
Instead of calling a function on each loop you can initialise the chunk before the loop. And you will have one function call less in the script.
Why are you not happy?
Btw, try to calculate it to see if there is any difference.
Instead of calling a function on each loop you can initialise the chunk before the loop. And you will have one function call less in the script.
increment = 10485760 chunk = f1.read(increment) while chunk: f2.write(chunk) full = os.stat(destination).st_size print(round(full / fullSize * 100, 1), '%\r') chunk = f1.read(increment)Alson, you can play with the 'increment' size to see what is the optimum one for your system.
Why are you not happy?
Btw, try to calculate it to see if there is any difference.
increment = 10485760 copied = 0 chunk = f1.read(increment) while chunk: f2.write(chunk) copied += increment print(round(copied / fullSize * 100, 1), '%\r') chunk = f1.read(increment)