title: Errno 2 using python shutil.py No such file or directory for file destination
body: <p>I am using the shutil python module to copy files and directories on a linux redhat machine.</p>
  
  <p>I wrote the following method, which takes in 2 params: src (the path of the file or dir that is being collected) and destination (the desired new path of where the collected log/dir is being pasted to).</p>
  
  <pre><code>def copy(src, destination):
      if(os.path.exists(src)):
          if(os.path.isdir(src)):
              if(os.path.exists(destination)):
                  shutil.copytree(src, destination+getTimeStamp())
              else:
                  shutil.copytree(src, destination)
          else:
              shutil.copy(src, destination)
      else:
          print src+" not found"
  </code></pre>
  
  <p>I have been using this method just fine, but I recently ran into an error when running this code:</p>
  
  <pre><code>copy("/home/midgar/logs/logger.xml", currentPath+"/testrun/logs/logger.xml")
  </code></pre>
  
  <p>The error: IOError: [Errno 2] No such file or directory: 'collectedLogs/testrun/logs/logger.xml'</p>
  
  <p>I would understand what this error implies if the file or directory that it is looking for is the src, but this is the destination that is causing the error. I found out that this line of code that throws the error goes to the line:   "shutil.copy(src, destination)" in my copy method. </p>
  
  <p>So far, my copy method just overwrites existing files, and if there is an existing directory, it creates a new one with a time stamp. In this case, the destination file does not already exist anyways. So, what can be the issue? Why am I getting this error with the DESTINATION path (when I would typically expect to see this kind of error with the SRC path).</p>
  
  <p>Could it possibly be because this is an .xml file?</p>