iCloud files are stored as a reference to the original file to save space. This is the case when the settings are set to “Optimize Mac storage”. However, unlike other providers, iCloud does not allow users to specify which folders should stay on the device or not.

In iCloud for Windows, there’s a “pin” functionality that makes a folder stay in the device.1

In Finder for Mac, there’s the “Download” or “Remove Download” context menu, but that decision might be overrode if iCloud senses that the device is low on space.

However, manually executing commands of brctl will indeed trigger a download or eviction of the files.

cd /the/folder/you/want/to/target
find . -type f -exec brctl evict {} \;

2

brctl evict will remove the files from the device.

brctl download will download the files to the device.

Similarly, you can use fileproviderctl materialize for downloading and fileproviderctl evict for removing, which can be used on third party services that do a similar synchronization, like Google Drive or Box.3

Footnotes

  1. Apple Support: Keep iCloud Drive files downloaded on your Windows computer

  2. macOS: Remove iCloud downloaded files from a folder (and sub-folders)

  3. StackOverflow: “brctl evict” and “brctl download” incompatible with Box?