I have my Documents folder synced with iCloud drive, I want to exclude some sub folders from the iCloud drive is there a way to achieve this?
Adding one empty file named
.nosync to a folder will prevent that folder from syncing.
You can also use this as a file extension to specific files, but the folder treatment is quite useful.
Once you've had a folder sync, you can now also prevent it from syncing on some (or all endpoints) with a utility named Bailiff, if for some reason you don't want just to delete the files from iCloud entirely and instead want to prevent the next "initial" sync.
Here are all the file/folder names excluded so maybe one of these could be used for a workaround:
- begins with
(A Document Being Saved
.nosync(in any case)
tmp(in any case)
.tmp(in any case)
desktop.ini(in any case)
- begins with ~$
Microsoft User Data(in any case)
$RECYCLE.BIN(in any case)
iPhoto Library(in any case)
Dropbox(in any case)
OneDrive(in any case)
IDrive-Sync(in any case)
.dropbox(in any case)
.dropbox.attr(in any case)
icon\r(in any case)
Extension is (in any case):
Extension is more than 2 chars and filename is
Source: reversing iCloud daemon.
Hopefully in a future version of the OS they let us put .nosync inside the folder to exclude it, or have an .IgnoreList like Resilio has.
It looks like directories that are named "tmp" or end with ".tmp" are not synced. A cloud icon with a line through it appears next to the directory along with anything inside of it.
Rename the folder or file:
mv fileorfolder fileorfolder.nosync
Create a symlink that get's synced:
ln -s fileorfolder.nosync fileorfolder
Repeat on every machine.
I created this Automator workflow to do it from the context menu in Finder https://github.com/tsdexter/iCloud-NoSync
I just create folders directly under my user home that I want to keep only locally (separate from my iCloud folders).