title: shutil copyfile giving Errno 2 on my destination folder
body: <p>I have written a function like below:</p>
  <pre><code>def separate_files(filetree_list, destination):
  
      from shutil import copyfile
      from os import makedirs
      from os.path import join, exists, commonprefix
      
      try:
          for file in filetree_list:
              dst = join(destination,
                         '\\'.join(file.split(commonprefix(filetree_list))[1].split('\\')[0:-1]))
              if not exists(dst):
                  print(dst, &quot; doesn`t exist. Creating...&quot;)
                  makedirs(dst)
                  print(exists(dst), &quot;. Path created.&quot;)
              print(file)
              copyfile(file, dst)
      except:
          print(&quot;Moving files has FAILED.&quot;)
      else:
          print(&quot;Moving files was SUCCESSFUL.&quot;)
  </code></pre>
  <p>When I call it with a &quot;filetree_list&quot; list containing a single element and destination prepared with os.path.join:</p>
  <pre><code>filetree_list = ['C:\\Users\\&lt;username&gt;\\staging_folder\\folder_1\\filename.xlsx'] 
  destination = os.path.join(staging_dir, 'Sorted', 'Unwanted_files')
  </code></pre>
  <p>I get the following error:</p>
  <pre><code>---------------------------------------------------------------------------
  FileNotFoundError                         Traceback (most recent call last)
  &lt;ipython-input-29-c3525a60c859&gt; in &lt;module&gt;()
       14         print(exists(dst), &quot;. Path created.&quot;)
       15     print(file)
  ---&gt; 16     copyfile(file, dst)
  
      C:\ProgramData\Anaconda3\lib\shutil.py in copyfile(src, dst, follow_symlinks)
      119     else:
      120         with open(src, 'rb') as fsrc:
  --&gt; 121             with open(dst, 'wb') as fdst:
      122                 copyfileobj(fsrc, fdst)
      123     return dst
  
  FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\&lt;username&gt;\\staging_folder\\Sorted\\Unwanted_files\\'
  </code></pre>
  <p>What is strange about it (and it is driving me insane at the moment), is that this folder definitely exists, and has been created by the &quot;if not exists(dst)&quot; block in separate_files function - I can even see it in the Windows Explorer!</p>
  <p>To add insult to injury, when I run this function with the same destination argument but multiple strings in a list, it does what I expect and there are no errors!</p>
  <p>Can anyone offer any insight into what am I doing wrong in here?</p>