PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Changing mtime of a symlink
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Changing mtime of a symlink

Réponse
 
LinkBack Outils de la discussion
Vieux 02/11/2007, 10h08   #1
Robert Latest
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Changing mtime of a symlink

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
  Réponse avec citation
Vieux 02/11/2007, 11h35   #2
rthangam
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Changing mtime of a symlink

On Nov 2, 2:08 pm, Robert Latest <boblat...@yahoo.com> 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-core.../msg10849.html

  Réponse avec citation
Vieux 02/11/2007, 12h28   #3
Cyrus Kriticos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Changing mtime of a symlink

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.
  Réponse avec citation
Vieux 02/11/2007, 12h40   #4
rthangam
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Changing mtime of a symlink

On Nov 2, 4:28 pm, Cyrus Kriticos <cyrus.kriti...@googlemail.com>
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 ?

  Réponse avec citation
Vieux 02/11/2007, 13h41   #5
Robert Latest
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Changing mtime of a symlink

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
  Réponse avec citation
Vieux 02/11/2007, 17h06   #6
Cyrus Kriticos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Changing mtime of a symlink

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.
  Réponse avec citation
Vieux 02/11/2007, 17h11   #7
Robert Latest
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Changing mtime of a symlink

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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h52.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14494 seconds with 15 queries