title: Can I synchronize files between remote folders using native Python/pywin32?
body: <p>I am on a desktop machine with access to a remote file server (both Windows). Read/write access is granted on login, I do not need to re-enter username and password.</p>
  
  <p>I want to:</p>
  
  <ul>
  <li>copy several very large files from one remote folder to another</li>
  <li>(the destination folder may contain a duplicate of an incoming file)</li>
  <li>avoid generating unnecessary network traffic</li>
  <li>(including not copying duplicates)</li>
  </ul>
  
  <p>Currently I perform a blind <code>shutil.copy2()</code> for all files. This means duplicates are copied unnecessarily. The sysadmin also reports that this generates unnecessary network traffic as data is copied from <em>remote-folder-1</em> to <em>local-memory</em> to <em>remote-folder-2</em>.</p>
  
  <p>Is there an existing command in native Python or pywin32 that accounts for these requirements?</p>
  
  <hr>
  
  <p>Discarded options include <a href="https://msdn.microsoft.com/en-us/library/aa363852%28VS.85%29.aspx" rel="nofollow">CopyFileEx</a> via pywin32 (which doesn't have duplicate checking), and native Python <a href="https://docs.python.org/2/library/filecmp.html" rel="nofollow">byte-checking</a> or <a href="https://docs.python.org/2/library/hashlib.html" rel="nofollow">checksumming</a> (which still read the files and thereby generate network traffic).</p>
  
  <p>Fallbacks include recording checksums, <a href="https://hg.python.org/cpython/file/2.7/Lib/filecmp.py#l59" rel="nofollow"><code>stat</code>-based comparison</a> (without byte-checking), and optimistic (partial) checksumming.</p>