Hi, all,
If you’re like me, you’d like to use iCloud Drive to sync between mobile devices and your desktop devices. As you know, Scrivener on mobile devices cannot use iCloud Drive, meaning that you cannot use it for sync.
Today I realized there’s a workaround. Using Shortcuts (available on all mobile devices since iOS 13), I created personal automations which trigger whenever the Scrivener app is opened and when it is closed. These automations copy the files back and forth in the background, ensuring they match.
So far, the experience seems pretty seamless. I’ll explain in detail below.
(The Shortcuts app can very useful, but using it is a somewhat advanced topic. I’ve written the advice below for people who have some familiarity with Shortcuts. If you feel uncomfortable attempting to follow it, consider skipping this post until a time when you’re more comfortable with your device.)
You’ll need two automations. First, set up one which is triggered by opening the Scrivener app. Then add the actions below.
- Get contents of folder
Writing
(do not choose recursive) - Repeat with each item in
Contents of Folder
- If
File Extension
is
scriv
(do not use a leading dot!)- Save
Repeat Item
toScrivener
(expand this action and choose to overwrite existing files)
- Save
- End If
- If
- End Repeat
- Nothing (to avoid notifications having the files attached)
I used the folder “Writing,” which is in my iCloud Drive, but you can use any folder you want. The “Scrivener” folder is the one used by the Scrivener app in “On My iPad” (or iPhone). The result should look like this screenshot:
We need a matching automation for when Scrivener is closed to copy the files back. Create it, and add the following actions:
- Get contents of folder
Scrivener
(do not choose recursive) - Repeat with each item in
Contents of Folder
- If
File Extension
is
scriv
(do not use a leading dot!)- Save
Repeat Item
toWriting
(expand this action and choose to overwrite existing files)
- Save
- End If
- If
- End Repeat
- Nothing (to avoid notifications having the files attached)
This is the same process as before, with the same settings, using the same folders as before, but the origin and destination folders have been swapped. Yours should look like this screenshot:
With those automations added, you should be done, and you can test it. If you’re having an issue, consider these notes:
- Choosing to get the contents of a folder recursively will mean that the
.scriv
bundles will not be seen as items and therefore will not be copied. This means that this process only works on items in the top-level folder you choose, not its subfolders. - If you’re talented at using Shortcuts’ automations, you may wish to add a small bit of conditional logic that will check for a file at the destination with the same name and a newer modification date before copying. This would prevent situations where the automation might overwrite a file. Otherwise, it’s assumed that:
- the contents of the “Writing” folder take precedence on opening Scrivener,
- the contents of the “Scrivener” folder take precedence on closing Scrivener, and
- no situation has occurred in which an automation was skipped.
- It’s possible to add notifications or alerts to various places in the actions. This can help with diagnosing a problem or just having a reminder occur that this background process is taking place. You can also have the automation ask permission before running at all.
One other thing to consider is that if you attempt to open a .scriv
project file directly from Files, it will create a duplicate due to the copying process. You should try to remember to open Scrivener directly to find your projects.
It’s possible to add automations to trigger at certain times a day as well, if you’d like. I have one that triggers just before sunrise and performs both of these synchronization steps.
I think that’s about it! Let me know if you have any questions or if anything’s unclear. I’ll update this topic if I discover something about this process that I can make better.