title: Copy content from one folder to another
body: <p>I'm trying to copy or move a JPG from one folder to another using the code below.</p>
  
  <pre><code>func moveItems(originPath: String, destinationPath: String, successBlock:@escaping () -&gt; Void, errorBlock:@escaping (_ error: Error) -&gt; Void) {
      do {
          try FileManager.default.copyItem(atPath: originPath, toPath: destinationPath)
          successBlock()
      } catch {
          print(error.localizedDescription)
          errorBlock(NSError())
      }
  }
  </code></pre>
  
  <p>But i always get the following error:</p>
  
  <blockquote>
    <p>open on
    /var/mobile/Containers/Data/Application/E138FDE0-A036-48D9-8E7C-518B6A5E452C/Documents/tailsImages/:
    File exists “3A75A51A-0946-45AF-BF1D-F4EB4D71ED68.png” couldn’t be
    copied to “Documents” because an item with the same name already
    exists.</p>
  </blockquote>
  
  <p>There are two problems that I don't understand. One is that the destination folder isn't the "Documents" that the error refers and the other is that the JPG only exists in the destinationPath folder. </p>
  
  <blockquote>
    <p>(lldb) po originPath
    "/var/mobile/Containers/Data/Application/E138FDE0-A036-48D9-8E7C-518B6A5E452C/Documents/tailsImagesSync/3A75A51A-0946-45AF-BF1D-F4EB4D71ED68.png"</p>
    
    <p>(lldb) po destinationPath
    "/var/mobile/Containers/Data/Application/E138FDE0-A036-48D9-8E7C-518B6A5E452C/Documents/tailsImages/"</p>
  </blockquote>