Reputation: 14863
from the documentation it is unclear how to do so?
file rename ?-force? ?- -? source target
file rename ?-force? ?- -? source ?source ...? targetDir
The first form takes the file or directory specified by pathname source and renames it to target, moving the file if the pathname target specifies a name in a different directory.
I don't see variable called pathname in function declaration.
Given a path/to/file.csv
How can I rename it to path/to/renamedfile.csv
?
set oldName foobar.txt
set newName bar.txt
file rename $oldName $newName
fails with permission denied, i guess it has to do with the file being in C:
how can this be done?
Upvotes: 0
Views: 5495
Reputation: 5301
I don't see variable called pathname in function declaration.
Your interpretation of the documentation wrong. Pathname is a description of the source and target arguments in the function declaration.
The first form takes the file or directory specified by (pathname) source and renames it to (pathname) target...
Your code for renaming foobar.txt
into bar.txt
is correct. Creating and apparently also renaming files directly under C:
requires administrator priviliges. You can get it by opening the shell (tclsh) or program with administrator priviliges, e.g. right click on icon and select "Run as administrator".
Upvotes: 1