Using mediainfo to extract the "Recorded_Date" from a video file, and using it to set the timestamp of the file. for f in *.mov; do t=$(mediainfo --Inform="General;%Recorded_Date%" "$f"); echo "$f $t"; [ -z "$t" ] && continue; t2=$(perl -e '$_=shift; s/[- :]//g; s/(\d\d)\.\d+$/.$1/; print' "$t"); touch -t "$t2" "$f" && echo "ok"; done or for f in *.mov; do # all mov files in current folder t=$(mediainfo --Inform="General;%Recorded_Date%" "$f") # get date echo "$f $t" [ -z "$t" ] && continue # skip if no date found in file t2=$(perl -e '$_=shift; s/[- :]//g; s/(\d\d)\.\d+$/.$1/; print' "$t") # convert format for touch touch -t "$t2" "$f" && echo "ok" # do it done