Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

share|improve this question
    
The default disk format (HFS+) for OS X does support hard links for directories –  Mark Dec 3 at 15:55

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Hooray for man pages! –  Christian L Feb 12 '12 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 Feb 13 '12 at 14:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.