I had numerous MTS video files from my camera all with the names 00000.mts and 00001.mts et cetera. Not really helpful. When looking at the files in the file explorer (nemo, linux mint) I didn’t want to have to change the view mode to “list view” every time to see when the files were created.
I wanted my video files to have the names of when and what time they were recorded – for example, the year, the month, the date and the hour (24 hour format), the minute and finally the second – YYYY-MM-DD_HH-MM-SS.ext this will allow me to group all video files in folders based on year and month and have no duplicates (as no video files taken with the same camera will be taken at exactly the same time). I’d like to be able to see what date and time they were taken without having to change the file manager view to “list mode”
The following command will rename all video files (.mts in this case) based on their time stamps. In linux mint’s terminal where your video files are, type the following:
for f in *.mts; do mv -n "$f" "$(date -r "$f" +"%Y-%m-%d_%H-%M-%S").mts"; done
this command will rename your file called 000000.mts (with the time stamp of 05 march 2017, 13:34:51) to the much easier to read file of 2017-03-05_13-34-51.mts
Much easier to see and organise your files with them using this naming scheme.
If you have any files with the extension MTS (not, mts — note the cAsE) change the *.mts to *.MTS and all files with an uppercase extension will be renamed.
for f in *.MTS; do mv -n "$f" "$(date -r "$f" +"%Y-%m-%d_%H-%M-%S").mts"; done