Rename a file: Difference between revisions

Content added Content deleted
(Add Mercury.)
m (re-order)
Line 625:
(rename-file "/input.txt" "/output.txt")
(rename-file "/docs" "/mydocs")</lang>
=={{header|Objective-C}}==
{{works with|Cocoa}}
 
{{works with|GNUstep}}
 
<lang objc>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];</lang>
 
=={{header|Objeck}}==
Line 646 ⟶ 631:
bundle Default {
class FileExample {
function  : Main(args  : String[]) ~ Nil {
File->Rename("input.txt", "output.txt");
File->Rename("docs", "mydocs");
Line 655 ⟶ 640:
}
</lang>
 
=={{header|Objective-C}}==
{{works with|Cocoa}}
 
{{works with|GNUstep}}
 
<lang objc>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];</lang>
 
=={{header|OCaml}}==