title: Swift: File Manager file location
body: <p>I am making small audio mobile application. </p>
  
  <p>I stores mp3 files in my app location folder:</p>
  
  <pre><code>let folderURL = URL(fileURLWithPath: Bundle.main.resourcePath!)
  ...
  let songPath = try FileManager.default.contentsOfDirectory(at: folderURL, includingPropertiesForKeys: nil, options: .skipsHiddenFiles)
  
          for song in songPath
          ...
  </code></pre>
  
  <p>So my destination folder is:</p>
  
  <blockquote>
    <p>file:///private/var/containers/Bundle/Application/0444F701-24A0-4500-A03C-2BB885966A63/MusicBox.app/M.I.A.%20-%20Paper%20Planes.mp3</p>
  </blockquote>
  
  <p>Now I am trying to download music from FTP using FileManager:</p>
  
  <pre><code>if let audioUrl = URL(string: "https://ftp.icm.edu.pl/packages/mp3/2221/08.%20Driver%20(vs.%20djalien).mp3") {
    let documentsDirectoryURL =  FileManager.default.urls(for: .applicationDirectory, in: .userDomainMask).first!
  
   // destination file url
      let destinationUrl = documentsDirectoryURL.appendingPathComponent(audioUrl.lastPathComponent)
      print("destinationUrl is :",destinationUrl)
  </code></pre>
  
  <p>Right now my destination folder is:</p>
  
  <blockquote>
    <p>destinationUrl is :
    file:///var/mobile/Containers/Data/Application/382E4E58-7939-467B-9315-D5315CF14483/Applications/08.%20Driver%20(vs.%20djalien).mp3</p>
  </blockquote>
  
  <p>How to set the same destination folder in (Bundle.main.resourcePath!)?</p>
  
  <p>It's my first application in Swift and I do not quite understand FileManager location. </p>