Exclude directories and files from iCloud Drive
To exclude a directory or file from being synced to iCloud Drive, simply add
.nosync
to its name:
$ mv ~/Documents/secrets ~/Documents/secrets.nosync/
Some programs depend on directories and files having a specific name, with
node_modules
being a good example. To exclude these directories from
syncing, without messing anything up, rename them to <directory name>.nosync
and create a symlink without the .nosync
part:
$ mv node_modules node_modules.nosync/ && ln -s node_modules.nosync node_modules