Backing up my photos and videos from iOS has always been painful. In the early days, it was plug a cable into my iPhone, open Image Capture, download everything and then save it all to a hard drive somewhere.
I don't pay for additional iCloud storage but I do have a home server to backup things like this which can be useful. As a result, in recent years, I've used a combination of things like NextCloud and Resilio Sync with mixed results. NextCloud was way too heavy for my use-case and although Resilio was good, the limitations that iOS puts on background processes means that I had to keep opening up the app in order for things to upload to my local server.
It's worth saying that I do also use Google Photos but I don't rely on it as a backup solution.
Shortcuts is something I've seen with recent iOS (and macOS) releases and it's something that I've always been interested in leveraging, especially given it's automation capabilites. I just never had an idea for what I could need it for...until now.
I'm not sure why it didn't occur to me sooner but I realised that Shortcuts is fully capable of executing scripts and running activities on a schedule which is the exact thing I was after for backing up things from my Camera Roll.
+in the top right corner to create a new one.
Itemsvariable type here.
/dev/stdin is the input received from each iteration. We then run a
scp command which copies the current item to a path on your server. The File Path variable is then used which will include the name of the file including its extension.
Regarding connection details to your server, I'd recommend using an SSH key.
You can generate one using the Shortcuts app. You can then add this manually
~/.ssh/authorized_keys file on the target
Alternatively, you can just use username and password.
Countvariable we created earlier.
All files that have been uploaded will be listed in the notification.
Xicon in the top-right corner of your newly created Shortcut and navigate using the tab bar at the bottom to Automation.
The first time this automation runs, you will be prompted for certain permissions. It's important that these are all set to Allow Always.
To do this, I'd recommend setting the automation schedule to sometime close to the future so you can witness it run for the first time and grant the Shortcut the permissions it needs.
Also note that it is possible to create the actions we created in the Shortcut directly inside a new Automation. However, you can't share automations. By creating it as a Shortcut first and then pointing your Automation to run that Shortcut allows you to share the Shortcut independent of the Automation.