0

I have a large number of YYMMDD.HHMMSS.mpg files. What I want is to copy the metadata to (the converted) YYMMDD.HHMMSS.mp4 files. Can this be done in batch?

touch -r *.mpg *.mp4

Diman
  • 1
  • "in batch" meaning each "mp4" file should have a unique time, matching the corresponding "mpg" file, or "batch" meaning every mp4 file should end up with one (arbitrary?) timestamp? – Jeff Schaller Sep 07 '18 at 16:13

1 Answers1

1
for f in ./*.mpg
do
  touch -r "$f" "${f%.mpg}.mp4"
done

... will touch loop over every mpg file and touch the corresponding mp4 file, referencing the mpg file.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255