How to exclude a sub folder from iCloud drive in macOS Sierra?
Solution 1:
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.
- https://eclecticlight.co/downloads/
Solution 2:
Here are all the file/folder names excluded so maybe one of these could be used for a workaround:
Filename:
- is
.DS_Store
- begins with
(A Document Being Saved
- contains
.nosync
(in any case) - is
.ubd
- contains
.weakpkg
- is
tmp
(in any case) - is
.tmp
(in any case) - is
desktop.ini
(in any case) - begins with ~$
- is
Microsoft User Data
(in any case) - is
$RECYCLE.BIN
(in any case) - is
iPhoto Library
(in any case) - is
Dropbox
(in any case) - is
OneDrive
(in any case) - is
IDrive-Sync
(in any case) - is
.dropbox
(in any case) - is
.dropbox.attr
(in any case) - is
icon\r
(in any case)
Extension is (in any case):
tmp
photoslibrary
photolibrary
aplibrary
migratedaplibrary
migratedphotolibrary
migratedaperturelibrary
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.
Solution 3:
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.
Solution 4:
Node developers: To add an empty file named .nosync to every node_modules subfolder, run this shell script from a parent directory:
find . -name node_modules -exec touch {}/.nosync \;
Solution 5:
Adding the .nosync
file to the directory is not working anymore.
The directory has to be renamed to contain .nosync
. Moreover, according to this thread on Reddit, it should be possible to chain the words like my_file.nosync.noindex
to not only mark file as not-to-sync but also to hide it from Spotlight.