I'm trying to export photos from iPhone using mac os Photos app.
The problem is that there is no way of structuring them in a format that will allow to easily access them by date.
Ideally I'd like to have filenames in with timestamp of a photo, something like: 2017-10-03-12-05
but it is not possible with the Photos app.
I would also tolerate some folders structure with date information, but I haven't found any suitable way.
The only way I found so far is by using subfolder format with Moment Name which creates subfolders with name of the location and date
Here is the example of folder name generated in this way:
Schloßpark Nymphenburg - Munich, Bavaria, October 19, 2017
However such name is almost unusable because there is almost no way to filter all photos let's say from October 2017.
I would really appreciate name like this:
2017-10-19 - Schloßpark Nymphenburg - Munich, Bavaria
which would allow easily sorting and structuring my photos.
Q: Does someone know any way of exporting photos in more usable names? I'd appreciate any way that will at least improve the way I'm exporting now.
Best Answer
Whilst this isn't the solution you were asking for, an equivalent outcome could be achieved if you were willing to employ a bit of AppleScript. AppleScript could be used to automate the exporting process from Photos and then rename the files that are created in Finder. But, honestly, I would suggest the exporting be done just as you're doing it now—from within the application—and then use AppleScript to collectively rename/move them afterwards.
You could also choose to format the date portion of the filename using the bash function
date
called from AppleScript with ado shell script
command, which does reduce the number of lines of code overall.I've pasted this shorter version of the script below for completeness.
It's worth saying that this code only works if the exported filenames are of a consistent pattern in line with the example you provided. Specifically, the exported filename needs to end in a date that occupies the last three words of the filename; and any text before it needs to have a comma and a space separating it from the date portion. Of course, the code can be adjusted accordingly if a different naming pattern is chosen, but it's best to choose one and stick with it.
If you need to create a directory hierarchy based on dates, this extra portion of script will create nested folders %Year/%Month/%Day/ and move the photo into the appropriate directory:
Now all of your exported photos will be renamed as per your guideline above, and organised in date-based directory hierarchies. Again, this extra portion of code could have been achieved using some
do shell script
commands (bash actually has a ready-made function for creating nested folders easily).As a final thought, if you wanted to automate the whole process, you could adapt this script to a folder action, and attach it to the folder into which your photos are exported. This means that, whenever Finder detects new photos added to the folder, it will automatically run the folder action script for you. Therefore, as soon as the photos are exported, they will immediately get renamed and moved accordingly.
Here's the first part of the script again, this time using a shell command to reformat the date portion of the filename:
As you can see, it's quite a bit shorter in terms of the number of lines of code, though I couldn't honestly tell you which will be faster or more robust.