title: How to Copy Files Fast
body: <p>It takes at least 3 times longer to copy files with <code>shutil.copyfile()</code> versus to a regular right-click-copy > right-click-paste using Windows File Explorer or Mac's Finder. 
  Is there any faster alternative to <code>shutil.copyfile()</code> in Python? What could be done to speed up a file copying process? (The files destination is on the network drive... if it makes any difference...).</p>
  
  <h3>EDITED LATER:</h3>
  
  <p>Here is what I have ended up with:</p>
  
  <pre><code>def copyWithSubprocess(cmd):        
      proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  
  win=mac=False
  if sys.platform.startswith("darwin"):mac=True
  elif sys.platform.startswith("win"):win=True
  
  cmd=None
  if mac: cmd=['cp', source, dest]
  elif win: cmd=['xcopy', source, dest, '/K/O/X']
  
  if cmd: copyWithSubprocess(cmd)
  </code></pre>