I recovered deleted videofiles from sd-card and now I cannot sort them by date.
I can see "encoded date" with mediainfo filename
.
How can I use the "encoded date" to sort videos, even rename them according to that date or better yet, rewrite "modified date" to file properties?
Assuming the line of output you have looks something like this (the date format does not matter):
You could rename the files as their dates with a little script...
I am giving them a final number to ensure files with the same date don't end up with exactly the same name, which would cause some to be overwritten. New filenames will be
2016-11-20-01.mp4
etc or whatever the date format from "Encoded date" is for you. Removeecho
after testing to actually rename the files. More readable version:Explanation
i=0
start iterating from 0for f in *
for all files in the current directory (replace with appropriate path or glob if necessary)printf -v new
format the new name like this$(mediainfo "$f" | sed -nr 's/Encoded date\s+: (.*)/\1/p')
extract the date info from the Encoded date field-%02d.mp4" "$((++i))"
add a number and extension to the end of each filenamemv -v -- "$f" "$new"
rename the files