Bash script for renaming images to a standard format using dates.
Requires installation of ExifTool (Install here).
If you want to standardize your image file collection and have your image names match the EXIF data creation date, then this is the tool for you.
Manually download the files in this repository to any directory or clone the repository using git. The main file is rename_images
which calls rename_file
, which can be used as a standalone file renamer. chmod
all bash scripts in the repository to be executable.
Call rename_images
with a root directory containing your image files as a parameter like:
/path/to/script/rename_images /path/to/root
It will then recursively loop through all the files in the directory and:
IMG_yyyymmdd_HHMMSS.ext
SS_yyyymmdd_HHMMSS.ext (screenshot, if indicated in filename)
VID_yyyymmdd_HHMMSS.ext
Example filenames:
IMG_20160905_023455.jpg
SS_20240826_120537.png
VID_20001208_223614.mp4
Certain corruptions were found in the filename dates after running rename_images
that needed to be tended to. The first part of the year (“20”) was present but the final two digits were cut off. Further investigation showed that it was from the current year, so this script does the same thing as rename_images
for those special scenarios. To be used with caution. See comments for more information.
This script simply moves all files in the subdirectories of a given root directory to the root without overwriting files, and then deletes all the empty subdirectories. To be used like:
/path/to/script/flatten_directory /path/to/root
rename_images
and rescue_images
to only process image files by evaluating the file extension.rename_images
and rescue_images
to allow custom filename formats.