Organizing photo stream with exiftool

I am used to use XnView when preparing yearly photobook. I rename all pictures to have Date taken exif attribute encoded in a file name along with a counter within the year. But recently I noticed two problems: some pictures miss exif data and XnView does not sort pictures correctly by this attribute (e.g. summer picture between autumn pictures). I googled that ExifTools library can handle my tasks as well. Another helpful site ryanmo gave me a hint, how to use it.

I copied files without exif data into new directory. Set Date taken exif attribute from file timestamp, preserving original timestamp:

exiftool.exe "-AllDates<filemodifydate" -P  .

Some files had wrong timestamp, so I had to set rough value manually:

exiftool "-AllDates=2015:05:09 12:00:00" .

Then I copied resulting files back to other pictures. Rename all files in current directory using exif Date taken attribute, add a counter that is ordered by Date taken attribute.

exiftool "-FileName<DateTimeOriginal" -d "foto-%Y-%m-%d_%H%M%%-C.%%e" -fileOrder DateTimeOriginal .

And the result is:


Update: XnView sorting issue was fixed with Options / File list, tab Misc, Exif date used to sort -> Date taken.