// See: https://apple.stackexchange.com/questions/328329/is-there-a-way-via-the-command-line-to-cause-icloud-files-to-download import Foundation func main() { let fm = FileManager.default for path in CommandLine.arguments[1...] { let url = NSURL.fileURL(withPath: path) guard fm.fileExists(atPath: url.path) else { fputs("\(url.path): doesn't exist\n", stderr) continue } do { try fm.startDownloadingUbiquitousItem(at: url) } catch { fputs("\(url.path): \(error.localizedDescription)\n", stderr) } } } main()