Set exif data based on directory name

Started by jimcampbell100, September 19, 2010, 02:21:48 PM

Previous topic - Next topic

jimcampbell100

I've received a load of scanned files that are all sorted into directories containing the year and month taken.  For example:

c:\photos\2009 12 - Christmas\photo1.jpg

The create date and date taken fields are both set based on the date they were scanned (obviously).  I'd like some way to set these fields based on the data in the path.  The day can just be the first day of the month.

Possible?  I hope so - I have a couple thousand files!

Thanks for any help--

Jim

Phil Harvey

Hi Jim,

This is similar to what was done in this thread.

If there are no other numbers in the directory name, you can do this without a user-defined tag like this:

exiftool -r "-createdate<$directory 01 00:00:00" ROOTDIR

The "01 00:00:00" fills in the necessary day, hr, min and sec values.  Note that single quotes should be used instead of double quotes if you are on Mac or Linux.

If there may be other numbers in the directory name, you can create a user-defined tag to extract the necessary parts from the directory name (as in other thread), but this requires a bit of Perl knowledge.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jimcampbell100