Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to add icon previews and retain time stamps' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to add icon previews and retain time stamps
Authored by: Nem on Sep 25, '07 11:43:25AM
Cudos - nice use of 'touch' to keep the file timestamp from getting updated. I've used the 'utime' function in the past to do this, but this is a nice way of doing it from the shell. Thanks - learned something today (and thus, its a good day!)

However, I don't like the temp file as a result of using touch (I see somebody else posted a 'trap' to at least clean up afterwards). Unfortunately, I don't see an easy way to convert the time output from something like 'stat' into the time format that 'touch' wants. If Mac's 'date' acted more like the GNU version, it would be easily doable. Actually, it would be fairly easy if you were to use perl instead of touch:

TSAVE=`perl -e '@s=(stat($ARGV[0]));print $s[9]' ${X}`
sips -i ${X}
perl -e 'utime($ARGV[0],$ARGV[0],$ARGV[1])' $TSAVE ${X}

---
Nem W. Schlecht
http://geekmuse.net/

[ Reply to This | # ]