Rename a file: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 57:
rename("/docs", "/mydocs")
)</lang>
 
=={{header|AWK}}==
Awk allows to call operating system commands with the ''system()'' function. However, the awk script won't get its output, only the return code. But this task is simple enough for the trivial implementation to work:
<lang awk>$ awk 'BEGIN{system("mv input.txt output.txt")}'
$ awk 'BEGIN{system("mv docs mydocs")}'
$ awk 'BEGIN{system("mv /input.txt /output.txt")}'
$ awk 'BEGIN{system("mv docs mydocs")}'</lang>
 
=={{header|AutoHotkey}}==
Line 73 ⟶ 66:
DirMove("docs", "mydocs")
DirMove("\docs", "\mydocs")
 
=={{header|AWK}}==
Awk allows to call operating system commands with the ''system()'' function. However, the awk script won't get its output, only the return code. But this task is simple enough for the trivial implementation to work:
<lang awk>$ awk 'BEGIN{system("mv input.txt output.txt")}'
$ awk 'BEGIN{system("mv docs mydocs")}'
$ awk 'BEGIN{system("mv /input.txt /output.txt")}'
$ awk 'BEGIN{system("mv docs mydocs")}'</lang>
 
=={{header|BaCon}}==
Line 151:
rename("/docs", "/mydocs");
return 0;
}</lang>
 
=={{header|C sharp}}==
 
<lang csharp>using System;
using System.IO;
 
class Program {
static void Main(string[] args) {
File.Move("input.txt","output.txt");
File.Move(@"\input.txt",@"\output.txt");
 
Directory.Move("docs","mydocs");
Directory.Move(@"\docs",@"\mydocs");
}
}</lang>
 
Line 187 ⟶ 202:
boost::filesystem::path("/mydocs"));*/
return 0;
}</lang>
 
=={{header|C sharp}}==
 
<lang csharp>using System;
using System.IO;
 
class Program {
static void Main(string[] args) {
File.Move("input.txt","output.txt");
File.Move(@"\input.txt",@"\output.txt");
 
Directory.Move("docs","mydocs");
Directory.Move(@"\docs",@"\mydocs");
}
}</lang>
 
Line 869:
 
The core <code>rename($oldfile,$newfile)</code> can rename a file within a directory, but has the usual limitations of the <code>rename()</code> system call or C library function, which means generally not working across filesystems, and perhaps not working to rename directories. <code>move()</code> does a copy and delete when necessary.
 
=={{header|Perl 6}}==
<lang perl6>rename 'input.txt', 'output.txt';
rename 'docs', 'mydocs';
rename '/input.txt', '/output.txt';
rename '/docs', '/mydocs';</lang>
 
=={{header|Phix}}==
Line 1,005 ⟶ 999:
(build-path root "mydocs"))
</lang>
 
=={{header|Perl 6Raku}}==
(formerly Perl 6)
<lang perl6>rename 'input.txt', 'output.txt';
rename 'docs', 'mydocs';
rename '/input.txt', '/output.txt';
rename '/docs', '/mydocs';</lang>
 
=={{header|Raven}}==
Line 1,323 ⟶ 1,324:
IO.File.Move(IO.Path.DirectorySeparatorChar & "input.txt", _
IO.Path.DirectorySeparatorChar & "output.txt")</lang>
 
=={{header|Yorick}}==
{{trans|UNIX Shell}}
<lang yorick>rename, "input.txt", "output.txt";
rename, "/input.txt", "/output.txt";
rename, "docs", "mydocs";
rename, "/docs", "/mydocs";</lang>
 
=={{header|Yabasic}}==
Line 1,342 ⟶ 1,336:
system(com$ + slash$ + "input.txt " + slash$ + "output.txt")
system(com$ + slash$ + "docs " + slash$ + "mydocs")</lang>
 
=={{header|Yorick}}==
{{trans|UNIX Shell}}
<lang yorick>rename, "input.txt", "output.txt";
rename, "/input.txt", "/output.txt";
rename, "docs", "mydocs";
rename, "/docs", "/mydocs";</lang>
 
=={{header|zkl}}==
10,327

edits