Rename a file: Difference between revisions

Content added Content deleted
(+Ic)
Line 195: Line 195:
== Icon and Unicon ==
== Icon and Unicon ==
==={{header|Icon}}===
==={{header|Icon}}===
Icon supports 'rename' for files.
<lang Icon>
</lang>
==={{header|Unicon}}===
==={{header|Unicon}}===
<lang Unicon>
<lang Unicon>every dir := !["./","/"] do {
rename(f := dir || "input.txt", dir || "output.txt") |stop("failure for file rename ",f)
</lang>
rename(f := dir || "docs", dir || "mydocs") |stop("failure for directory rename ",f)
The Icon solution works in Unicon.
}</lang>
Note: Icon and Unicon accept both / and \ for directory separators.


=={{header|J}}==
=={{header|J}}==