I was looking for a solution to this, since choosing the remove download
optin from the context menu did not work, like at all.
Through a stackexchange discussion, I found a script from Rakesh, that works like a charm.
cd /the/folder/you/want/to/target
find . -type f -exec brctl evict {} \;
So what does this do?
The cd
takes us to the top folder whose downloaded content we want to remove. So this does not have to be the top iCloud folder, but could be any sub-folder.
Then, find
recursively collects all the files in the directory and sub-directories. We could be more specific here and add filters for file types or names, but in this case, we just take everything. This article seems like a decent starting point for further reading on the find
command.
-exec
let’s us run a command on the found file. In our case brctl
, which let’s us work with the iCloud files. evict
removes the download. The {}
is a placeholder from find
and will be replaced with the individual path of each file.
brctl
could also be used to download the file, so we could flip the script, in order to download all files recursively.