Location Based Folders

Started by irinaonline, June 08, 2017, 06:17:29 AM

Previous topic - Next topic

irinaonline

I am not very savvy when it comes to the Exiftool and I would need some help with the syntax.

All my photos are geotagged and I archive them in location and not in time based folders. This gives me a far better and quicker experience, when I need to find to picture, as someone remembers the location better than the month or year, when a picture was taken.

I try now to automate this process with the help of Exiftool and would need some help with the syntax.

On this example you can see, that I create the folder, but I run into different problems/errors with this:

exiftool "-directory<D:\Users\Leo\Dropbox\All\0WL6\0WL6 $CountryCode $Country $State $City $Location $SupplementalCategories" -ext jpg -ext mp4 -ext png -ext mov -if "$DateTimeOriginal ge '20150701' and $DateTimeOriginal lt '20180101'" "D:\Users\Leo\Dropbox\All\0WL6"

Problem 1: Not all fields above are filled out and if the last field is not filled out at all, then Windows will not create the folder (space at the end). How can I remove all leading, ending or double spaces, before exiftool tries to create a folder?

Problem 2: On some occasions I want use less than all 6 Codes. For example I want use the $Location, if it is filled and the $SupplementalCategories is empty. Or I want use the $SupplementalCategories, if it is filled and then I want to ignore the $Location. How can I make use of the if command in such scenario?

Problem 3: I need to prevent that a folder name exceeds 65 characters. Is there a possibilty to truncate a folder name to x characters or to create a folder with less than these 6 codes, if with these 6 codes it will exceed 65 characters?

Problem 4: I need to prevent that the folder contains more than 1000 pictures. In this case a new folder should be created (for example with folder name + an increasing number). How could this be achieved?

Thank you for any suggestions/solutions!



Phil Harvey

This may be done with a rather complicated user-defined Composite tag.  The attached config file may give you want you want with a command like this:

exiftool -config my.config "-directory<mydir" -ext jpg -ext mp4 -ext png -ext mov -if "$DateTimeOriginal ge '20150701' and $DateTimeOriginal lt '20180101'" "D:\Users\Leo\Dropbox\All\0WL6"

The trickiest part was limiting the number of files in each directory.

I suggest you run this command first to be sure it is doing what you want before actually moving the files:

exiftool -config my.config -mydir -ext jpg -ext mp4 -ext png -ext mov -if "$DateTimeOriginal ge '20150701' and $DateTimeOriginal lt '20180101'" "D:\Users\Leo\Dropbox\All\0WL6"

- 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 ($).

irinaonline

thank you for your quick response. i have to read into that now.