Rename a file: Difference between revisions

Content added Content deleted
No edit summary
(Added Elixir)
Line 23: Line 23:
* file extension syntax;
* file extension syntax;
* file system root (provided there is any).
* file system root (provided there is any).

=={{header|ALGOL 68}}==
=={{header|ALGOL 68}}==
{{works with|ALGOL 68|Standard - no extensions to language used}}
{{works with|ALGOL 68|Standard - no extensions to language used}}
Line 182: Line 183:
}
}
}</lang>
}</lang>



=={{header|Clipper}}==
=={{header|Clipper}}==
Line 222: Line 222:
std.file.rename("docs","mydocs");
std.file.rename("docs","mydocs");
std.file.rename("/docs","/mydocs");</lang>
std.file.rename("/docs","/mydocs");</lang>

=={{header|DCL}}==
=={{header|DCL}}==
<lang DCL>rename input.txt output.txt
<lang DCL>rename input.txt output.txt
Line 250: Line 251:
where["docs"].renameTo(where["mydocs"], null)
where["docs"].renameTo(where["mydocs"], null)
}</lang>
}</lang>

=={{header|Elixir}}==
<lang elixir>File.rename "input.txt","output.txt"
File.rename "docs", "mydocs"
File.rename "/input.txt", "/output.txt"
File.rename "/docs", "/mydocs"</lang>


=={{header|Emacs Lisp}}==
=={{header|Emacs Lisp}}==
Line 355: Line 362:
}
}
}</lang>
}</lang>



=={{header|Harbour}}==
=={{header|Harbour}}==
Line 532: Line 538:
rename file "/input.txt" to "/output.txt"
rename file "/input.txt" to "/output.txt"
rename folder "/docs" to "/mydocs"</lang>
rename folder "/docs" to "/mydocs"</lang>



=={{header|Locomotive Basic}}==
=={{header|Locomotive Basic}}==
Line 560: Line 565:
RenameFile["input.txt", "output.txt"]
RenameFile["input.txt", "output.txt"]
RenameDirectory["docs", "mydocs"]</lang>
RenameDirectory["docs", "mydocs"]</lang>



=={{header|MATLAB}} / {{header|Octave}}==
=={{header|MATLAB}} / {{header|Octave}}==
Line 966: Line 970:
moves = { "input.txt" => "output.txt", "/input.txt" => "/output.txt", "docs" => "mydocs","/docs" => "/mydocs"}
moves = { "input.txt" => "output.txt", "/input.txt" => "/output.txt", "docs" => "mydocs","/docs" => "/mydocs"}
moves.each{ |src, dest| FileUtils.move( src, dest, :verbose => true ) }</lang>
moves.each{ |src, dest| FileUtils.move( src, dest, :verbose => true ) }</lang>

=={{header|Run BASIC}}==
=={{header|Run BASIC}}==
RB has no direct command. You Shell out to windows or unix.
RB has no direct command. You Shell out to windows or unix.