title: iphone: copy or move file from document directory folder
body: <p>Here is my code.</p>
  
  <pre><code>NSArray *pathSong = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *toPath = [[pathSong objectAtIndex:0] stringByAppendingPathComponent:@"Songs"];
      NSString *fromPath=[[pathSong objectAtIndex:0] stringByAppendingPathComponent:@"abc"];
      NSString *strdestination = [fromPath stringByAppendingPathComponent:@"sg.mp3"];
      NSError *Error;
      if([[NSFileManager defaultManager]fileExistsAtPath:strdestination]){
          if([[NSFileManager defaultManager]copyItemAtPath:strdestination toPath:toPath error:&amp;Error]==NO){
              UIAlertView *Alert=[[UIAlertView alloc]initWithTitle:@"copy" message:[NSString stringWithFormat:@"%@",Error] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
              [Alert show];
          }
          else{
              UIAlertView *Alert=[[UIAlertView alloc]initWithTitle:@"Not copy" message:[NSString stringWithFormat:@"%@",Error] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
              [Alert show];
          }
      }
  </code></pre>
  
  <p>I am getting the error logo :</p>
  
  <blockquote>
    <p>Error Domain=NSCocoaErrorDominCode=516 "The operation couldn't be
    completed .(Cocoa arrow 516.)" userInfo=0x681abf0</p>
    
    <p>NSUnderlyingError =0x681b920 "The operation couldn't be completed
    .File exists"</p>
  </blockquote>
  
  <p>abc folder  there is no song name "sg.mp3" but I'm still getting the file exists error. I don't know where I did mistake?</p>