title: How to deal with OSError: [Errno 20] Not a directory: '.DS_Store'?
body: <p>I want to copy some pictures from on directory to another directory, and here is my code:</p>
  
  <pre><code>import os.path
  import shutil
  
  def copyFile(sourceDir,targetDir):
      for files in os.listdir(sourceDir):
          sourceFile=os.path.join(sourceDir,files)
          if os.path.isfile(sourceFile) and sourceFile.find('.jpg')&gt;0:
              shutil.copy(sourceFile,targetDir) 
  
  for i in os.listdir('/Users/liuchong/Desktop/LFW/new'):
  
      copyFile(i,'/Users/liuchong/Desktop/LFW/lfw')  
  </code></pre>
  
  <p>But when I run it ,the terminal tells me that<code>OSError: [Errno 20] Not a directory: '.DS_Store'</code> 
  I know 'DS_dstore' is a hidden file in Mac, but how can I solve this bug?</p>