Rename a file: Difference between revisions

Content added Content deleted
(add E example)
(→‎{{header|Tcl}}: Note that 'file nativename' is usually unnecessary)
Line 261: Line 261:
=={{header|Tcl}}==
=={{header|Tcl}}==
<i>Assuming</i> that the Bash example shows what is actually meant with this task (one file and one directory here, one file and one directory in the root) and further assuming that this is supposed to be generic (i.e. OS agnostic):
<i>Assuming</i> that the Bash example shows what is actually meant with this task (one file and one directory here, one file and one directory in the root) and further assuming that this is supposed to be generic (i.e. OS agnostic):
<lang tcl>file rename inputs.txt output.txt

file rename inputs.txt output.txt
file rename docs mydocs
file rename docs mydocs
file rename [file nativename /inputs.txt] [file nativename /output.txt]
file rename [file nativename /inputs.txt] [file nativename /output.txt]
file rename [file nativename /docs] [file nativename /mydocs]
file rename [file nativename /docs] [file nativename /mydocs]</lang>
Without the need to work on unusual platforms like Mac OS 9, the code could be just:
<lang tcl>file rename inputs.txt output.txt
file rename docs mydocs
file rename /inputs.txt /output.txt
file rename /docs /mydocs</lang>


=={{header|Toka}}==
=={{header|Toka}}==