I am trying to copy a large file (> 1 GB) from hard disk to usb drive using
src_file = "source\to\large\file"
dest = "destination\directory"
ptime 1.0 for Win32, Freeware - http://www.
Copyright(C) 2002, Jem Berkes <jberkes@pc-t
=== test.py ===
Execution time: 542.479 s
ptime 1.0 for Win32, Freeware - http://www.pc-tools.net/
Copyright(C) 2002, Jem Berkes <firstname.lastname@example.org>
=== xcopy F:\test.iso L:\usb\test.iso
1 File(s) copied
Execution time: 128.144 s
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
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)