Set the "date taken" on photos with ExifTool

Scanned or undated photos often have no EXIF date, so photo libraries (Immich, PhotoPrism, Synology Photos) sort them by file date. ExifTool can set it. 
 Install 
 sudo dnf install perl-Image-ExifTool # RHEL/Rocky (EPEL)
sudo apt install libimage-exiftool-perl # Debian/Ubuntu
 
 Set one fixed date on every JPG in a folder (recursively) 
 exiftool -r -ext jpg -ext jpeg -AllDates="2005:11:06 03:20:00" /path/to/photos
 
 -AllDates sets DateTimeOriginal, CreateDate and ModifyDate together. 
 Copy DateTimeOriginal into the other date tags 
 Quote the argument. Unquoted, bash reads < as "read input from a file". 
 exiftool -r -ext jpg '-AllDates<DateTimeOriginal' /path/to/photos
 
 Backups 
 ExifTool keeps a name.jpg_original copy of every file it changes. Once you have checked the result: 
 exiftool -r -delete_original! /path/to/photos
 
 Or use -overwrite_original up front if you have your own backup. 
 As a tiny script 
 #!/bin/bash
dir=${1:-.}; when=${2:?usage: setdate <dir> "YYYY:MM:DD HH:MM:SS"}
exiftool -r -ext jpg -ext jpeg -AllDates="$when" "$dir"