Sunday 27 September 2020

Change file creation date to modification date and shift date using terminal

https://apple.stackexchange.com/questions/359566/change-file-creation-date-to-modification-date-using-terminal



for f in *.[iI][mM][gG]; do m="$(GetFileInfo -m "$f")"; SetFile -m "$m" -d "$m" "$f"; done




for f in *.[mM][pP][4]; do m="$(GetFileInfo -m "$f")"; SetFile -m "$m" -d "$m" "$f"; done




https://apple.stackexchange.com/questions/197895/how-to-do-a-batch-change-shift-of-file-creation-date


for f in DSC_*.*; do

    ts="$(GetFileInfo -d "$f")"

    e="$(date -j -f "%m/%d/%Y %H:%M:%S" "$ts" +%s)"

    ((o=60*60*5))

    ((e+=o))

    nd="$(date -r $e "+%m/%d/%Y %H:%M:%S")"

    SetFile -m "$nd" "$f"

    SetFile -d "$nd" "$f"

done


for f in DJI_*.*; do

    ts="$(GetFileInfo -d "$f")"

    e="$(date -j -f "%m/%d/%Y %H:%M:%S" "$ts" +%s)"

    ((o=16*60))

    ((e-=o))

    nd="$(date -r $e "+%m/%d/%Y %H:%M:%S")"

    SetFile -m "$nd" "$f"

    SetFile -d "$nd" "$f"

done