Sort Photos By Location And Put In Named Folders

Gets Photos' images and copies them to separate location-based iCloud Drive folders.


Description

The shortcut searches the Photos app for the latest photos and puts them in the newly created folders on iCloud Drive at /iCloud Drive/Shortcuts/. It serves as an example of what can be done with the shortcut "Make Association List" used as a key compound to build this one on. Each folder is named according to the location of a photo. Existing files are overwritten. The shortcut works only with the help of "Make Association List", available to download as you're prompted to when you launch this shortcut for the first time or hadn't downloaded "Make Association List" before. In addition to the main purpose, the shortcut also shows the information about the created folders in the form of an association list – a list of key-value pairs – and copies it to Universal Clipboard making it available across your Apple devices for you to review or use it should such a necessity arise.

iCloud Drive must be enabled and have free storage.

Note. This shortcut is the new version of a shortcut named identically but is completely reworked. However, because of the relative complexity that went into its structure, it isn't the fastest one: some decisions making an impact on its speed had to be implemented in order to overcome the shortcomings of its predecessor, such as inadvertent skips of valid images meeting the location criteria; the behaviour resulted in 0 added files. A user can choose how many photos and what albums to search through. Make up your mind based on the performance and sophistication of your Apple device.

Warning. As of iOS 15.1 there's a bug which when using the built-in Shortcuts action to get the location the photo was taken at both as a standalone action and a parameter of a photo stored in a variable will not return the location's info: this is spurred by a shortcut's action added to identify the photos without geotags. In this case, you see an alert that "No photos with locations were found" even though these photos actually have the locations embedded (false positive). If you encounter this bug in the current or any other versions of iOS, please report it to Apple or be aware.

To test for this bug download and install the shortcut Exists Location. Select a photo you know to have location tags and run the shortcut on it: if the location is retrievable you'll see the notification banner titled "Parameter not empty" display location information, if not, the "Parameter empty" banner appears. This shortcut proceeds only with those photos that aren't screenshots; screenshots have the default behaviour to not embed location information.

Feedback is welcome.


Latest Release Notes

2.2 - Nov. 30, 2021, 9:45 a.m.

Added a loop to circumvent a false negative while checking the Shortcuts library for the existence of the "Make Association List" shortcut.


Version history