I am trying to copy a large file (> 1 GB) from hard disk to usb drive using shutil.copy
. A simple script depicting what I am trying to do is:-
i
Your problem has nothing to do with Python. In fact, the Windows copy process is really poor compared to the Linux system.
You can improve this by using xcopy
or robocopy
according to this post: Is (Ubuntu) Linux file copying algorithm better than Windows 7?. But in this case, you have to make different calls for Linux and Windows...
import os
import shutil
import sys
source = "source\to\large\file"
target = "destination\directory"
if sys.platform == 'win32':
os.system('xcopy "%s" "%s"' % (source, target))
else:
shutil.copy(source, target)
See also: