Changing mtime of a symlink
Changing mtime of a symlink
am 02.11.2007 10:08:28 von Robert Latest
Hello,
I've got a directory full of symlinks to some documents, and this directory
gets mirrored (by weex) onto an ftp server.
When deciding which files to transfer, weex looks at the modification
timestamp of the file in question. If that hasn't changed since the last
transfer, the file won't be sent.
My problem is that when one of the pointed-to files is modified, the mtime
of the symlink doesn't change accordingly. So I tried this to sync the
links' timestamps with their targets:
find . -type l -printf 'touch -r "%l" "%h/%f"\n' | sh
However, it seems that if used on a symlink, touch modifies the target, not
the link.
General question: How can the modification time of a symlink be set to an
arbitrary date?
Thanks,
robert
Re: Changing mtime of a symlink
am 02.11.2007 11:35:14 von ramesh.thangamani
On Nov 2, 2:08 pm, Robert Latest wrote:
> Hello,
> I've got a directory full of symlinks to some documents, and this directory
> gets mirrored (by weex) onto an ftp server.
>
> When deciding which files to transfer, weex looks at the modification
> timestamp of the file in question. If that hasn't changed since the last
> transfer, the file won't be sent.
>
> My problem is that when one of the pointed-to files is modified, the mtime
> of the symlink doesn't change accordingly. So I tried this to sync the
> links' timestamps with their targets:
>
> find . -type l -printf 'touch -r "%l" "%h/%f"\n' | sh
>
> However, it seems that if used on a symlink, touch modifies the target, not
> the link.
>
> General question: How can the modification time of a symlink be set to an
> arbitrary date?
>
> Thanks,
> robert
Robert seems it is not supported by unix like kernals to change the
timestamp of symlink. Found discussion at the following link:
http://www.mail-archive.com/bug-coreutils@gnu.org/msg10849.h tml
Re: Changing mtime of a symlink
am 02.11.2007 12:28:10 von Cyrus Kriticos
Robert Latest wrote:
>
> How can the modification time of a symlink be set to an
> arbitrary date?
Recreate you symlink with
ln -sf target link_name
--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.
Re: Changing mtime of a symlink
am 02.11.2007 12:40:09 von ramesh.thangamani
On Nov 2, 4:28 pm, Cyrus Kriticos
wrote:
> Robert Latest wrote:
>
> > How can the modification time of a symlink be set to an
> > arbitrary date?
>
> Recreate you symlink with
>
> ln -sf target link_name
>
> --
> Best regards | Be nice to America or they'll bring democracy to
> Cyrus | your country.
Yeah recreating the symlink is a better option, but again changing the
modification time to an arbitary
date doesn't seem to be possible ?
Re: Changing mtime of a symlink
am 02.11.2007 13:41:38 von Robert Latest
Cyrus Kriticos wrote:
> Recreate you symlink with
>
> ln -sf target link_name
Yeah, but then it has today's date and not the one I want (namely, the date
of the linked file).
robert
Re: Changing mtime of a symlink
am 02.11.2007 17:06:46 von Cyrus Kriticos
Robert Latest wrote:
> Cyrus Kriticos wrote:
>
>> Recreate you symlink with
>>
>> ln -sf target link_name
>
> Yeah, but then it has today's date and not the one I want (namely, the date
> of the linked file).
Right, my mistake.
What about recreating all links as hard links?
--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.
Re: Changing mtime of a symlink
am 02.11.2007 17:11:38 von Robert Latest
Cyrus Kriticos wrote:
> What about recreating all links as hard links?
Nothing wrong with hard links. Except I don't really like 'em. Ho hum, I
just might do that.
robert