Home » Questions » Computers [ Ask a new question ]

Rename photos during download from camera - on Linux?

Rename photos during download from camera - on Linux?

On Windows, I'm using this feature (right-hand text) of the excellent cam2pc software to download images&videos from my camera and rename them in the same step. I haven't found any software for Linux that does the same, or does it as good. Suggestions please?

Asked by: Guest | Views: 262
Total answers/comments: 2
Guest [Entry]

"A custom solution requires a little programming -- I need to write a shell script:

Use the find command to see if the newly mounted USB drive contains media files;
if no media files are found, then abort the script.
find ""/media/disk/dcim"" -iname ""img*.*"" -type f
Use the read command to prompt for a topic. (Equals %P in the question.)
Find the timestamp of the oldest media file.
ls -GgtR --full-time --time-style +""%Y%m%d %H%M"" *.png | tail -1 | cut -c21-34

Hints:
-GgtR = hide group and owner, sort by time, list Recursively.
tail = keep only the last 1 line of the output.
cut = keep only the characters 21-34.

Use mkdir to create a new folder based on that date and topic.
Use the find command with the -execdir option to find all media files,
then move (mv) each hit to the new folder,
then use jhead to rename each hit according to each file's timestamp.
Optional: Use the umount command to unmount the USB drive.
Set up Linux to execute this script when an USB drive is mounted. The detection of the USB drive (or camera) varies depending on the Linux variant; refer to OS-specific documentation. Or just run the script manually...

I'll need to spend invest some hours in learning bash commands, and also in learning how Linux mounts drives."
Guest [Entry]

"A custom solution requires a little programming -- I need to write a shell script:

Use the find command to see if the newly mounted USB drive contains media files;
if no media files are found, then abort the script.
find ""/media/disk/dcim"" -iname ""img*.*"" -type f
Use the read command to prompt for a topic. (Equals %P in the question.)
Find the timestamp of the oldest media file.
ls -GgtR --full-time --time-style +""%Y%m%d %H%M"" *.png | tail -1 | cut -c21-34

Hints:
-GgtR = hide group and owner, sort by time, list Recursively.
tail = keep only the last 1 line of the output.
cut = keep only the characters 21-34.

Use mkdir to create a new folder based on that date and topic.
Use the find command with the -execdir option to find all media files,
then move (mv) each hit to the new folder,
then use jhead to rename each hit according to each file's timestamp.
Optional: Use the umount command to unmount the USB drive.
Set up Linux to execute this script when an USB drive is mounted. The detection of the USB drive (or camera) varies depending on the Linux variant; refer to OS-specific documentation. Or just run the script manually...

I'll need to spend invest some hours in learning bash commands, and also in learning how Linux mounts drives."