1

I've just converted hundreds of AIF recordings from a few days ago to WAV, but I need the newly created files to keep the original Creation Date of the recordings. Filenames are identical apart from the extension, stored in two separate folders.

Is there a way to batch modify each WAV's Creation Date to match its respective AIF?

Thanks!

  • Thanks, yes I saw this and others about touch, but couldn't find any that mention batch-matching another set of files' dates. Let me know if I'm missing something. – davidt Feb 14 at 10:04
  • Basically you need to process by file, read the creation date from the AIF using stat and apply it to the WAV. Can write something in a few hours once I‘m in front of my Mac :-) – nohillside Feb 14 at 10:18
  • Are all the files in the same folder? – nohillside Feb 14 at 10:19
  • Oh that'd be amazing if you could! I'm a php guy that ain't too hot with unix, so your previous comment just whooshed past me. The files are currently in two separate folders, but I can place them in the same folder if it helps keep things simple. – davidt Feb 14 at 10:24
0

Assuming a folder structure like

./
+--AIFFolder/
+--WAVFolder/

and also assuming that the WAV files end in .wav you can use

cd AIFFolder
for f in *; do
    date=$(stat -f %SB -t %Y%m%d%H%M "$f")
    base=${f%.*}
    touch -t $date ../WAVFolder/"$base".wav
done

This can be simplified (thanks for the hint, @fd0) to

cd AIFFolder
for f in *; do
    touch -r "$f" ../WAVFolder/"${f%.*}.wav"
done
  • You could have just one line in your loop by using the -r option- touch -r "$f" ../WAVFolder/"${f%.*}.wav" – fd0 Feb 15 at 8:14
  • @fd0 I didn’t even know about that option, great stuff. Feel free to edit the code :-) – nohillside Feb 15 at 8:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .