[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how to change last modification time of a symlink

Posted on 2001-09-09
6
Medium Priority
?
583 Views
Last Modified: 2013-12-26
I need to change last modification time of a symlink. I tried with 'utime' library call, but it follows symbolic link and change the inode.st_mtime field of the file the link is referring to.

Is there another call to change that field to the symlink itself?
If not, does anybody known a trick to do it?

I also read 'touch' man page. It does not have such a functionality.

thank you for your support.
0
Comment
Question by:mliberi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6468913
touch can do it, but only as user root (not shure for links, this probably also depends on the underlaying shell)
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6470598
touch sits on top of utime, so if utime can't do it, then touch can't do it either.

What exactly is the problem you're trying to solve?  utime follows links because the folks who did links couldn't imagine a situation where anyone would care what the modification time of a link was.

The only way I know of to change the mod time of a link is to delete the link and recreate it.
0
 
LVL 3

Author Comment

by:mliberi
ID: 6470841
I'm trying to restore a saved symlink. I use lchown to restore uid and gid and I would expect a system call or C library call exist to set last modification time too.

Removing and recreating the link is not a solution because it sets current time, not a generic timestamp. Change current time for the time necessary to do that operation is not an accepted solution.
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 14

Accepted Solution

by:
chris_calabrese earned 400 total points
ID: 6472176
Like I said, the creators of the sym-link stuff assumed that mod times for a link aren't important, so there's no way to do this.  You'd need an lutime or an futime, which don't exist.
0
 
LVL 21

Expert Comment

by:tfewster
ID: 8191635
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- Answered by chris_calabrese

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
0
 

Expert Comment

by:modulo
ID: 8241253
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question