title: shutil.move if directory already exists
body: <p>I have a code that I am using to move all jpg files from source to destination. First time the code runs fine and it moves the files but if I run it again, it gives an error that the file already exists.</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/tom/Downloads/direc.py", line 16, in &lt;module&gt;
      shutil.move(jpg, dst_pics)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py", line 542, in move
      raise Error("Destination path '%s' already exists" % real_dst)
  shutil.Error: Destination path '/Users/tom/Downloads/Dest/Pictures/Photo3.jpg' already exists
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre><code>import os
  import glob
  import shutil
  
  local_src = '/Users/tom/Downloads/'
  destination = 'Dest'
  
  src = local_src + destination
  dst_pics = src + '/Pictures/'
  
  print(dst_pics)
  
  for pic in glob.iglob(os.path.join(src, "*.jpg")):
      if os.path.isfile(pic):
          if not (os.path.isfile(dst_pics + pic)):
              shutil.move(pic, dst_pics)
          else:
              print("File exists")
  </code></pre>
  
  <p>Is there anything that I can do so it can overwrite the file or checks to see if the file exists and skip it?</p>
  
  <p>I was able to solve it by following @Justas G solution.</p>
  
  <p><strong>Here is the solution</strong></p>
  
  <pre><code>for pic in glob.iglob(os.path.join(src, "*.jpg")):
      if os.path.isfile(pic):
          shutil.copy2(pic, dst_pics)
          os.remove(pic)
  </code></pre>