Search code examples
cocoansfilemanager

Cocoa move directories


How do I move directories in cocoa?

Whenever I use NSFileManager I get an error.

NSFileManager* fileManager = [NSFileManager defaultManager];
[fileManager moveItemAtPath:[srcpath retain] toPath:[dstpath retain] error:&error];

I end up getting the error:

nameOfDir1 couldn't be moved to nameOfDir2


Solution

  • Oh, I had to enter the directory name that I'm copying after the directory that I'm copying to.