Is there a way via the command line to cause .icloud files to download?
Solution 1:
Scott Garret and Allan’s answer above is very close.
In the terminal, however, each *.icloud
file is prefixed with a .
when NOT downloaded.
For example, a directory called foo
with optimised (i.e., offloaded to icloud) files a.txt
and b.txt
will look like this
$ cd foo
$ find . -name '.*icloud’
./.a.txt.icloud
./.b.txt.icloud
To resolve (i.e., download) the files from icloud, you need to pass the path to the resulting path to /usr/bin/brctl
.
Thus, the following works.
find . -name '.*icloud' | perl -pe 's|(.*)/.(.*).icloud|$1/$2|s' | while read file; do brctl download "$file"; done
You can monitor the download activity as per this answer as follows :
brctl log --wait --shorten
Solution 2:
The command you are looking for is brctl
(located in /usr/bin
). man brctl
will tell you all you need, but basically just brctl download /path/to/filename
(without the .icloud extension) and evict
will purge the locally cached copy.
Solution 3:
To my knowledge, there is no command included that allows you to directly download an iCloud file or folder.
But since I had exactly the same problem as you, I found that it was possible to do it in Swift with the startDownloadingUbiquitousItem function.
So I wrote a really simple Swift script for downloading both folder and file. You can download it on Github: iCloud Downloader
I hope I have answered your issue.