I have a single file named a.caf in the documents directory. I would like to rename it when user types into a UITextField
and presses change (the text entered in the UITextField
should be the new filename).
How can I do this?
You can use moveItemAtPath.
NSError * err = NULL;
NSFileManager * fm = [[NSFileManager alloc] init];
BOOL result = [fm moveItemAtPath:@"/tmp/test.tt" toPath:@"/tmp/dstpath.tt" error:&err];
if(!result)
NSLog(@"Error: %@", err);
[fm release];