Rename a file: Difference between revisions

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