Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

goyalpk

macrumors newbie
Original poster
Hi there,

NSFileManager's method copyItemAtPath fails while copying folder from USB flash drive to Desktop.

Error description is :

Error Domain=NSPOSIXErrorDomain Code=1 UserInfo=0x10df30 "Operation could not be completed. Operation not permitted"

Actually it creates folder on Desktop but not the files inside the source folder.

Is it because of permission difference for file in USB flash drive and the file which needs to be created on Desktop?

Code is:

Code:
	NSString *srcPath = @"/Volumes/USB DRIVE/hello123";
	NSString *destPath = @"/Users/Pankaj/Desktop/hello123";
	NSFileManager *fm = [NSFileManager defaultManager];
	
	BOOL isCopySuccess = NO;
	
	NSError *err;
	isCopySuccess = [fm copyItemAtPath:srcPath toPath:destPath error:&err];
	
	if(isCopySuccess)
		NSLog(@"copy successfull");
	else
	{
		NSLog(@"copy failed");
		NSLog(@"%@", [err description]);
		
		
	}

Thanks so much in advance.
Pankaj
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.