Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am looking for a smart way to bulk rename directories in my photo library based on the date the pictures were taken.

My specific use case: Export the image library from iPhoto or Aperture on OS X to a more permanent and OS-independent file and folder structure.

The input list of directories would look like this:

1.2.2012
input_directory_name

The renamed output should look like this:

2012-02-01 - 2012-02-22
2012-03-14 - 2012-03-14 input_directory_name

The dates should be picked either from the creation dates of the pictures in the directory (oldest / newest date) or alternatively from the metadata of the files (JPEG, TIFF, RAW...).

If the input_directory_name is looking like a date "1.2.2012" then it should be skipped.

If the input_directory_name contains text the text should be added to the new directory name. Reason: Unnamed events in iPhoto / Aperture are autmatically tagged with a date which unfortunately has the badly sortable order of DD.MM.YYYY

I googled a bit but couldn't easily find a clever way - possibly someone else has encountered this issue before?

share|improve this question
    
IIRC, the exitool manage page has examples for that. –  Stephane Chazelas Nov 3 '12 at 23:49
add comment

1 Answer

First of all: if you are going to be trying solutions use a full copy or a copy of a subset of the pictures to avoid disaster.

You could try something along the lines of:

for folder in $(ls -l | awk '{print $9}'); 
    do <magic here>;
done

The magic could be something like using the identify command if this is available to you. From what I read it can read exif data from pictures. Based on this you could perhaps create a folder or move the directory etc etc.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.