Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Tcl] file copy does not "touch" file. Why?

59 views
Skip to first unread message

Sektor van Skijlen

unread,
Mar 21, 2006, 5:49:37 AM3/21/06
to
In a situation, when both source and destination files exist, file copy (with
-force of course) does not update the last modification time of the
destination file. This "feature" has a strong impact on cooperation with
'make'.

Is that really intended? I have to do 'touch' externally to make it correct.
The external "cp" command on unix does touch the destination file.

--
// _ ___ Michal "Sektor" Malecki <sektor(whirl)kis.p.lodz.pl>
\\ L_ |/ `| /^\ ,() <ethourhs(O)gmail.com>
// \_ |\ \/ \_/ /\ C++ bez cholesterolu: http://www.intercon.pl/~sektor/cbx
"I am allergic to Java because programming in Java reminds me casting spells"

Donal K. Fellows

unread,
Mar 21, 2006, 6:28:55 AM3/21/06
to
Sektor van Skijlen wrote:
> In a situation, when both source and destination files exist, file copy (with
> -force of course) does not update the last modification time of the
> destination file. This "feature" has a strong impact on cooperation with
> 'make'.

It's that way because it makes it easier to do archival backups. If you
want the mtime of the destination to be *now*, try this:

proc creatingFileCopy {source destination} {
file copy $source $destination
file mtime $destination [clock seconds]
}

You might argue that there should be an option to tell [file copy] to
not copy the metadata. I'd probably not argue the matter, but currently
the metadata copy is done, since it's part of producing a "copy".

Donal.

Sektor van Skijlen

unread,
Mar 21, 2006, 10:04:50 AM3/21/06
to
Dnia Tue, 21 Mar 2006 11:28:55 +0000, Donal K. Fellows skrobie:

I might argue that there should be an option to file copy:

% file copy -force -mtime $source $target

And it's fine. In particular, works as unix cp command.

0 new messages