I have approximately 60 audio files with a partial time stamp in their names. These names were created automatically by the recording system and are shown as below
201106_0099.wav
201106_0100.wav
201106_0101.wav
.
.
.
201106_0163.wav
The files are in a folder named with the date (yymmdd), initial and ending hour, minute and second (HHMMSS) of the recordings just like
Audios_201106_063044_190708
Each audio file has exactly 11 minutes 38 seconds.
Using the command stat from terminal with zsh I get, for the first file, I get information about the start time of a recording:
my_name@Air-of-My_Name Audios_201106_063044_190708 % stat 201106_0099.wav
16777221 1381621 -rw-rw-r-- 1 my_name staff 0 67032620 "Mar 4 21:11:14 2021" "Nov 6 06:30:44 2020" "Mar 4 12:06:13 2021" "Nov 6 06:30:44 2020" 4096 130928 0 201106_0099.wav
Using ffmpeg, I get info about the duration of the recording:
my_name@Air-of-My_Name Audios_201106_063044_190708 % ffmpeg -i 201106_0099.wav
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from '201106_0099.wav':
Duration: 00:11:38.26, bitrate: 768 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
Almost the same info I get from SoX
my_name@Air-of-My_Name Audios_201106_063044_190708 % soxi 201106_0099.wav
Input File : '201106_0099.wav'
Channels : 1
Sample Rate : 48000
Precision : 16-bit
Duration : 00:11:38.26 = 33516288 samples ~ 52369.2 CDDA sectors
File Size : 67.0M
Bit Rate : 768k
Sample Encoding: 16-bit Signed Integer PCM
I would like to batch rename all of them with their complete time stamp, just like
0099_yyyymmdd-HHMMSS.wav.
What would be a good, maybe 'swiss army knife' solution to my problem, using unix, SoX or even Python? Thanks in anticipation.