views:

20

answers:

1

HEllo,

I have a only a single file by name of a.caf in documents diretory . I want to rename it when user taps into textbox annd press change (the text entered into textbox should be the new filename). How is it possible ? Thanks in advance .

Thanks, Mindfreak

+1  A: 

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];
diciu