8

I would like to change the modified date of a symlink. The symlink points to a directory so it cannot be a hardlink. The following command works fine in the terminal for an actual directory, but it does not modify the modified date on the symlink. How can I do this and why does the command not work on symlinks?

touch -mt 201202112109 "Users/scott/actual directory"
touch -mt 201202112109 "Users/scott/symlink"

First one works, second one does not. the symlink actually points to the directory with the modified mod date. both are owned by same owner (me) and have same permissions. Running Lion 10.7.3

1
  • The default disk format (HFS+) for OS X does support hard links for directories
    – mmmmmm
    Commented Dec 3, 2014 at 15:55

1 Answer 1

10

You need to add the '-h' parameter to modify symbolic link timestamps.

In your case:

touch -mht 201202112109 "Users/scott/symlink"

Without the '-h' the timestamp of the file that is linked to is modified.

2
  • Hooray for man pages! Commented Feb 12, 2012 at 5:29
  • I almost never use the man page from the terminal, I prefer the html man pages at developer.apple.com. I did check there - the latest version choice is 10.6.6 and it does not reference th -h flag. Lesson learned, but I did not just throw a question up without some research first.
    – Scott
    Commented Feb 13, 2012 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .