title: Backing up/copying an entire folder tree in batch or python?
body: <p>I'm trying to copy an entire directory from one locations to another via python every 7 days to essentially make a backup...</p>
  
  <p>The backup folder/tree folder may or may not exist so it needs to create the folder if it doesn't exist, that's why I assumed <code>distutils</code> is better suited over <code>shutil</code></p>
  
  <p><strong>Note</strong> Is it better for me to use batch or some other language for the said job?</p>
  
  <p>The following code:</p>
  
  <pre><code>import distutils
  distutils.dir_util.copy_tree("C:\Users\A\Desktop\Test", "C:\Users\A\Desktop\test_new", preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=1, verbose=0, dry_run=0)
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\A\Desktop\test.py", line 2, in &lt;module&gt;
      distutils.dir_util.copy_tree("C:\Users\A\Desktop\test", "C:\Users\A\Desktop\test2", preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=1, verbose=0, dry_run=0)
  AttributeError: 'module' object has no attribute 'dir_util'
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks in advance
  - Hyflex</p>