Set or change the EXIF date of an image with a right click action.
EXIF date Thunar action

Jump Straight In!
Basic Tab
Name: EXIF date
Description: Set / change EXIF date for images
Command: xfce4-terminal --title "Set EXIF Date" --command "bash exif %F"
Appearance Conditions Tab
File Pattern: *
Appears if selection contains: Image Files
To add a custom action open Thunar file manager from the menu select Edit -> Configure custom actions…
The Bash Script
#!/bin/bash
# Script to set EXIF date for an image file(s).
#
# Requires 'exiftool'. Install with: sudo apt install libimage-exiftool-perl
#
# Name: Create EXIF date
# Description: Set / change EXIF date for images
# Command: xfce4-terminal --title "Set EXIF Date" --command "bash exif %F"
# Appearance Conditions
# File Pattern: *
# Appears if selection contains: Image Files
# Check if exiftool is installed
if ! command -v exiftool &> /dev/null; then
echo "Error: exiftool is not installed."
echo "Please install it using: sudo apt install libimage-exiftool-perl"
exit 1
fi
# Validate that at least one file exists and is a regular file.
if [ "$#" -eq 0 ]; then
echo "Error: No files specified."
exit 1
fi
# Prompt the user to input a new date or use today's date
read -p "Enter 'today' to use today's date or enter a new date (YYYY:MM:DD): " new_date
if [ "$new_date" == "today" ]; then
# Get today's date in YYYY:MM:DD format
new_date=$(date +'%Y:%m:%d')
else
# Validate the date format using regex.
if ! [[ "$new_date" =~ ^[0-9]{4}:[0-9]{2}:[0-9]{2}$ ]]; then
echo "Error: Invalid date format. Please use YYYY:MM:DD."
exit 1
fi
fi
for image_file in "$@"; do
# Check if the file exists and is a regular file.
if [ ! -f "$image_file" ]; then
echo "Warning: File '$image_file' does not exist or is not a regular file. Skipping..."
continue
fi
# Construct the exiftool command. Add time to match exiftool's expected format.
exiftool_command="exiftool -overwrite_original -DateTimeOriginal=\"$new_date 00:00:00\" -ModifyDate=\"$new_date 00:00:00\" \"$image_file\""
# Execute the exiftool command and display the output.
echo "Setting EXIF date for '$image_file' to $new_date..."
eval "$exiftool_command" # Use eval cautiously, but necessary here due to variable expansion.
# Check the exit code of exiftool.
if [ $? -eq 0 ]; then
echo "EXIF date successfully updated for '$image_file'."
else
echo "Error: EXIF date update failed for '$image_file'."
fi
done
exit 0
The examples on this page use the bin directory within the user’s Home directory. Home -> User -> bin. Place the script in the bin folder.
What You’ll Need:
- Thunar File Manager: (Part of XFCE desktop environment)
exiftool
: A powerful command-line utility for reading, writing, and editing image metadata. You must have this installed.- Installation: Open a terminal and run:
sudo apt install libimage-exiftool-perl
(or the appropriate package manager command for your Linux distribution).
- Installation: Open a terminal and run:
- Bash Shell: (Typically pre-installed on most Linux distributions)
- A location to store the script. The recommended location is in your user’s
bin
directory (/home/<your_username>/bin
).
Creating the Custom Action in Thunar:
- Open Thunar Configuration: From the Thunar menu, select Edit -> Configure custom actions….
- Add a New Action: Click the “+ Add” button to create a new custom action.
- Configure the Action Details:
Field | Value | Description |
---|---|---|
Name: | EXIF date | The name that will appear in the right-click menu. |
Description: | Set / change EXIF date for images | A brief explanation of what the action does. |
Command: | xfce4-terminal --title "Set EXIF Date" --command "bash /home/<your_username>/bin/exif %F" (Replace <your_username> with your actual username) | This command opens a terminal window, sets the title to “Set EXIF Date,” and executes the exif script (located in your bin directory), passing the selected file(s) as arguments. The %F is a Thunar variable that represents the full path of the selected files. Important: Adjust the path /home/<your_username>/bin/exif to match where you saved the exif script. |
Appearance Conditions Tab – File Pattern: | * | This allows the action to apply to any file type. |
Appears if selection contains: | Image Files | This ensures the action only appears when you right-click on image files (e.g., JPG, PNG, TIFF). |
The Bash Script (exif
– Save this as a file named exif
in your /home/<your_username>/bin/
directory):