steeldriver's idea was that after initial renaming files that failed preserve their name. By looking for the pattern characteristic for old names you extract only files without exif - that should be done with find -iregex. Run the find command alone to see if you get any output. If not then regex is wrong or you simply have 0 matching files.
Next stage is generating the list of properties, similar to my version, but with additional timestamp which is a property of the file itself - creation/modification time (-printf <format string> where %TY-%Td-%Tm_%TH-%TM-%TS is the time).
find output would be like this:
Code:
./ls/ls/2.jpg ./ls/ls 2011-30-03_19-25-07.3390610000
./ls/ls/3.jpg ./ls/ls 2011-30-03_19-25-07.3390610000
tab separated list of filepath / path (dir) / timestamp
you pass that to while read filepath / path /timestamp and use these fields to generate mv command.
Code:
mv "$filepath" "$path/$timestamp"
only fix required would be adding the extension to the new name and possibly dropping trailing subsecond digits ( "${timestamp%.*}.jpg" )
while IFS=$'\t' read ... is required, otherwise read won't be able to parse lines into fields correctly.
Note that the timestamp may or may not be useful, because it depends on the file history. You need to check if the suggested dates make any sense. Another caveat is it's possible for files to have the same timestamp - my junk example files surely do - and you would risk overwriting files processed earlier.
Bookmarks