Never waiting to Sync Icloud Push your Mobile Performance

Platform

[X] iOS
[ ] Android

Obsidian Mobile version: v 1.0.5


We all love Obsidian but sometimes its anoing to wait to Sync the Icloud Files. especially if you have only Edge.

I bought a workaround on Fiverr and mabye one of you have the same problem. I want to Share it.

Here is my Guide:

  1. Download the App Scriptable.
  2. Open Scriptable, open settings and add a Bockmark Folder. Take the Obsidian Folder.
  3. Open Apple shorcuts and create an automation. Take a action to Sync your vault your preferably. I take verytime i connect to a Wi-Fi.
  4. take “run Inline script” as action.
  5. Add the script:
    let bookmarkName = “Obsidian”
    let fm = FileManager.iCloud()
    if(fm.bookmarkExists(bookmarkName)) {
    let folder = fm.bookmarkedPath(bookmarkName)
    let files = fm.listContents(folder)
    files.forEach(f)
    function f(name) {
    let filePath = fm.joinPath(folder, name)
    fm.downloadFileFromiCloud(filePath)
    }
    return (“Bookmark '” + bookmarkName + “' found\n\n” + “Files found:\n” + files)
    }else {
    return “Bookmark '” + bookmarkName + “' not found”
    }
    Script.complete()

Done!
In my case my Vault on my iphoneX and my Ipad Pro 2 or 3 :slight_smile: is a lot faster.

if you have some feedback, let me know.

Hope this make your day a little bit better.

3 Likes

Thanks for sharing!

After copy and pasting the script, it first did not work, but then I noticed that the single and double quotes in the script got mangled when the code was posted to the forum. Here is a fixed version for anyone else interested in trying this out:

let bookmarkName = "Obsidian"
let fm = FileManager.iCloud()

if(fm.bookmarkExists(bookmarkName)) {
	let folder = fm.bookmarkedPath(bookmarkName)
	let files = fm.listContents(folder)
	files.forEach(f)
	
	function f(name) {
		let filePath = fm.joinPath(folder, name)
		fm.downloadFileFromiCloud(filePath)
	}

    return ("Bookmark '" + bookmarkName + "' found\n\n" + "Files found:\n" + files)

} else {
    return "Bookmark '" + bookmarkName + "' not found"
}

Script.complete()

I just got it working, so I don’t have a sense yet, to what extent it will actually reduce/eliminate the “Waiting for iCloud to synchronize” wait times for me, but I don’t see why it wouldn’t. I’m very glad I found this thread.

For anyone else trying this out:
The script looks like it’s supposed to display either a “Bookmark ‘Obsidian’ not found” message or a list of the files that it found. Those messages are only shown, however, when you run the script from inside the Shortcuts app (i.e., by pressing the little blue “play icon” button in the bottom right while editing the Run inline script action). When the actual automation is triggered, you only get a generic “Running your automation” notification, which is preferable anyway, because the point of the script is only to trigger an iCloud sync for the Obsidian folder.

 

Mission accomplished! :slight_smile:

2 Likes

thanks for share.

but the script only work for the file in the folder, if my folder have child-folder, the file in child-folder won’t be download.

how to solve this?

1 Like

Scriptable app can only on mobile, how about macOS?

@einfachJens @BeR I’m not seeing the Obsidian folder in my iphone (possibly because I chose icloud to store the vault from the start in Osidian app. Am I missing something?

1 Like