Date modified not updating
For example, `-r foo -d '-5 seconds'' specifies a time stamp equal to five seconds before the corresponding time stamp for `foo'. This works(using sed to convert date to format touch can handle): 'touch -d $(identify -format %[exif: Date Time] $f|sed -r 's/:/-/;s/:/-/;') $f' It's been a long time since I wrote any kind of Unix program, but I accidentally set the year incorrectly on a bunch of Christmas photos, and I knew if I didn't change the date from 2015 to 2014 it would be a problem later on. JPG') # use newline as file separator (handle spaces in filenames) IFS=$'\n' for f in $ do # read file modification date using stat as seconds # adjust date backwards (1 month) using date and print in correct format # change file time using touch touch -t $(date -v -1m -r $(stat -f %m "$") %Y%m%d%H%M.%S) "$" done #! This works(using sed to convert date to format touch can handle): 'touch -d $(identify -format %[exif: Date Time] $f|sed -r 's/:/-/;s/:/-/;') $f' That may have unforeseen consequences.
I don't know if the shell fragments in my answer would work with strict POSIX shell utilities.Any help would be greatly appreciated as I am nearing the end of my rope on this one. We're a friendly computing community, bustling with knowledgeable members to help solve your tech questions.Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free.You'll be able to ask any tech support questions, or chat with the community and help others.