title: How to copy a file to a specific folder in a Python script?
body: <p>I have the path of a file stored in a variable (say) filePath. I would like to copy that particular file to another specific folder within a Python script. </p>
  
  <p>I tried </p>
  
  <pre><code>folderPath = (os.getcwd() + "/folder_name/") #to get the path of the folder
  shutil.copyfile(filePath, folderPath)
  </code></pre>
  
  <p>But I got an error  <code>IOError: [Errno 21] Is a directory</code>.</p>
  
  <p>How can I solve this ?</p>
  
  <p>My question might seem to be  a duplicate of <a href="https://stackoverflow.com/questions/123198/how-do-i-copy-a-file-in-python">How do I copy a file in python?
  </a>. But actually, I want to copy a file to a <strong>folder/directory</strong> whereas most answers to that question mention copying one file to another <strong>file</strong>.</p>