Cecil Westerhof <
Ce...@decebal.nl> wrote:
> Ralf Fassel <
ral...@gmx.de> writes:
>
>> * Rich <ri...@example.invalid>
>> | Cecil Westerhof <
Ce...@decebal.nl> wrote:
>> | > Ralf Fassel <
ral...@gmx.de> writes:
>> | >> See "file rename".
>> | >>
>> | >>
https://www.tcl.tk/man/tcl/TclCmd/file.htm#M31
>> | >
>> | > I should have looked a bit more careful. :'-( I saw rename and
>> | > thought it was just renaming a file.
>>>
>> | Be careful though.
>>>
>> | The /bin/mv command will, silently, transform a cross device "mv" into
>> | a "cp" followed by an "rm". The [file rename] command does not perform
>> | that silent conversion and will instead generate an error on a cross
>> | device move.
>>
>> Is this OS-specific? I can "file rename" on Linux just about anything
>> (files, empty and filled directories) from local disk to NFS and back,
>> and also between local disk partitions... tcl 8.5.19, Opensuse 15.1
>
> It does not go wrong. I just touched a test file. Waited five minutes
> and did a mv to another device. The timestamp was still correct.
Ok, I learned something I did not already know about Tcl today (at
least with 8.6, which was the version I used to test).
It is not documented in the manpage, but file rename does silently
switch to performing a cp/rm when crossing devices. The only thing
that changed is that the timestamp applied to the moved file lost its
fractional seconds (but as Tcl's file stat also ignores fractional
seconds, I'm not too concerned there).
Which now makes me wonder if there is any value in explicitly calling
this out in the manpage?