DISQUS

Tech-Recipes: Create/modify a UNIX file with an arbitrary timestamp | Solaris system administration | Tech-Recipes

  • gandalf · 5 years ago
    How do you handle symbolic links? The touch command affects the target of the symbolic link and not the link itself.
  • qmchenry · 5 years ago
    Good question. I've never noticed this behavior before. I don't see any options for touch that would make it not follow the link. If you really need the link to be updated by a touch and it is in the same filesystem as the real file, you could use a hard link. When you touch a hard link, it updates both the link and the original file. The hard link doesn't look like a symbolic link, it just looks like a regular file, which may not be desirable. That's the only suggestion that I have. Anyone else?

    Quinn
  • Migxi · 5 years ago
    Excellent..... now.....

    Who to stamp the timeref file with a date like 15 days ago ?
  • fracai · 4 years ago
    touch -B <#> will set the timestamp to a date in the past by the number of seconds provided

    ie. touch -B 10 will make the file appear 10 seconds older than the current date.

    man touch is more helpful than waiting a few months for an answer :)