[NTLUG:Discuss] changing timestamp on symbolic link?

Darin W. Smith darin_ext at darinsmith.net
Wed Mar 12 09:10:08 CST 2003


On Wed, 12 Mar 2003 08:43:13 -0600, Lance Simmons <lance at lsimmons.net> 
wrote:

> I'd like to change the timestamp on a link (hard or symbolic, I don't
> care which) without changing the timestamp on the target.
>
> Does anyone know how to do that?
>
> If it's impossible, why do symbolic links have timestamps at all?
>

Now there's an interesting question! :)
 
As far as I know, it is impossible--at least with standard tools like 
touch.  Only certain types of operations (e.g., 'rm') work on the link file 
itself.  The reason a symbolic link has a timestamp is that it is actually 
a file...a different file from the file it points to...and has a structure 
that redirects kernels that know how to interpret it to the linked file.  
That is, a symbolic link has its own inode, different than that of the 
linked file, and that inode has all the timestamp characteristics of any 
other file.
 
A hard link is simply an aliased name for the same inode...therefore, a 
hard link can never have a different timestamp than the linked file, 
because it *is* the file.
 
As for symlinks, it *might* be possible to use midnight commander or some 
such to modify the timestamp, but I don't know because I've never had to do 
that.  You would have to use something that can ignore the "special" status 
of the file as a link.  Another option might be emacs' dir-edit (directory 
edit) mode.

-- 
D!
Darin W. Smith
AIM: JediGrover




More information about the Discuss mailing list