osx - Mac OS or Linux - Change year but leave Month Day Hours & Seconds untouched -
i need recurse directory tree , update year portion of timestamp files year. can't work out how touch. can't use touch -a since the target files have many different years relative adjustment out.
i want update years 2013 regardless of need leave rest of time stamp untouched. possible?
any appreciated. thanks, steve.
#!/bin/sh #this ensure output of commands in english export lang=c #gets modification date file, can change other timestamp instead. moddate=$(stat $1 | fgrep modify | cut -d" " -f2) year=2013 #sets month , day old date month=$(echo $moddate | cut -d- -f2) day=$(echo $moddate | cut -d- -f3) newdate=$year-$month-$day #sets new date touch -d $newdate $1
Comments
Post a Comment