This code copies the specified file and places it in the Docs directory. I am trying to create a simple backup solution. The problem is that this operation does not overwrite the existing file if the operation is repeated.
Two questions:
What is the best way to rewrite in code?
How difficult would it be to add the current date to each copied file? In this case, the rewrite operation will not be performed. This would be much more useful for storing incremental backups. If I decided to do it this way, I realized that I would need to create a new path so that everything was organized.
Thanks.
Floor
NSString * name = @"testFile"; NSArray * files = [NSArray arrayWithObject: name]; NSWorkspace * ws = [NSWorkspace sharedWorkspace]; [ws performFileOperation: NSWorkspaceCopyOperation source: @"~/Library/Application Support/testApp" destination: @"~/Documents/" files: files tag: 0];
source share