7/01/2014

Shutil.copytree() is unbelievebly slow :(

I found that copying large files with shutil.copytree() method is quite slow. So had to replace it with "robocopy" in windows compromising portability of the script.

Instead of usinng "shutil.copytree(prod1, dest_p1, symlinks=False, ignore=None, ignore_dangling_symlinks=False)"
use 

 os.system("robocopy /S %s %s" % (source, Destination))(this supports later windows versions)  
   
 subprocess.call("robocopy /S %s %s" % (source, Destination))  
   
 OR  
   
 xcopy in Windows  
 os.system("xcopy /S %s %s" % (source, Destination))  

1 comment:

  1. Useful information provided on your blog. But I had to discontinued robocopy because of its slow speed. Even after trying so many things and solutions it does not. After that I am using GS Richcopy 360 to solve my problems all thanks to its 100% multi threaded file transfer it makes the process lightning fast. Its very time efficient and remember time is money, use it to save your money indirectly. Hope it helps!

    ReplyDelete