title: Move .png on desktop to new directory
body: <p>Relatively new to python, trying to move files based on type from one directory to another.</p>
  
  <pre><code>import shutil
  import os
  source = 'C:\Users\home\Desktop'
  Unsorted = 'C:\Users\home\Desktop\'
  Sorted = 'B:\Pictures'
  file = os.listdir(source)
  for f in file("Unsorted"):
      if file.endswith(".png",".jpg"):
          print(os.path.join("Sorted", file))
  </code></pre>
  
  <p>I would appreciate any help. Thank you.</p>
  
  <p><strong>Edit</strong>
  Thank you for the help and the links. I really appreciate it. I am reading automatetheboringstuff, and    Modern Python Cookbook (2018).</p>
  
  <pre><code>import os
  source = 'C:\\Users\\home\\Desktop'
  sorted = 'B:\\Pictures'
      for f in os.listdir(source):
          if f.endswith((".png",".jpg",".jpeg")):
          print(os.path.join(sorted, f))
  </code></pre>
  
  <p>I believe it works, since I am not getting any errors, but it's not moving the files. It seems to work here: <a href="http://prntscr.com/i2ht88" rel="nofollow noreferrer">link</a>. Maybe it doesn't work between drives? Anyway, thank you!</p>
  
  <p><strong>EDIT</strong> I got it to work!</p>
  
  <pre><code>import os
  import shutil
  
  source = os.path.join('C:\\Users\\home\\Desktop')
  sort = os.path.join('B:\\Pictures')
  
  for f in os.listdir(source):
      if f.endswith((".png",".jpg",".jpeg")):
          shutil.move(os.path.join(source, f), sort)
  </code></pre>
  
  <p>Thank you everyone for your help! I hope you guys have a great rest of your day! Thanks. :D </p>