Task

Rename:

   a file called     input.txt     into     output.txt     and 
   a directory called     docs     into     mydocs.


This should be done twice:  
once "here", i.e. in the current working directory and once in the filesystem root.

It can be assumed that the user has the rights to do so.

(In unix-type systems, only the user root would have
sufficient permissions in the filesystem root.)




NSFileManager *fm = [NSFileManager defaultManager];
 
// Pre-OS X 10.5
[fm movePath:@"input.txt" toPath:@"output.txt" handler:nil];
[fm movePath:@"docs" toPath:@"mydocs" handler:nil];
 
// OS X 10.5+
[fm moveItemAtPath:@"input.txt" toPath:@"output.txt" error:NULL];
[fm moveItemAtPath:@"docs" toPath:@"mydocs" error:NULL];