Rename a file: Difference between revisions

→‎{{header|R}}: Added REBOL example.
m (moved File Rename to File/Rename: Take advantage of MediaWiki's concept of page hierarchies.)
(→‎{{header|R}}: Added REBOL example.)
Line 318:
file.rename("docs", "mydocs")
file.rename("/docs", "/mydocs")</lang>
 
=={{header|REBOL}}==
<lang REBOL>rename %input.txt %output.txt
rename %docs/ %mydocs/
 
rename %/input.txt %/output.txt
rename %/docs/ %/mydocs/
 
; DOS/Windows:
 
rename %/c/input.txt %/c/output.txt
; For whatever reason, it seems you have to change to the drive root to rename directories there.
x: what-dir change-dir %/c/ rename %docs/ %mydocs/ change-dir x
</lang>
 
=={{header|Ruby}}==
Anonymous user