shell - Use "Touch -r" for several files with automator -


i use "macos x yosemite (10.10.4)"

i've converted video mts files mov files using quicktime, new file created doesn't preserve original creation date.

filea.mts --> creation date: 07/02/2010 10:51

filea_converted.mov --> creation date: today 8:35

i'd change creation date attribute of several files, using date of original files. know can using terminal "touch" command in order this:

touch -r filea.mts filea_converted.mov  touch -r fileb.mts fileb_converted.mov 

as have more 200 files change creation date, possible automate using automator script shell action, or other way?

like in bash shell - in terminal (untested):

#!/bin/bash orig in *.mts;     # generate new name old 1    new="${orig/.mts/_converted.mov}"    echo touch -r "$orig" "$new" done 

save above in file called dodates , type in terminal

chmod +x dodates          # make script executable ./dodates                 # run script 

sample output

touch -r freddy frog.mts freddy frog_converted.mov touch -r filea.mts filea_converted.mov 

at moment nothing, run it, see if says, , remove word echo , run again if looks ok.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -