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?
This method doesn't work anymore. you need to change the directory name to
*.nosync, as described in other answers.
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.
.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.
I created this Automator workflow to do it from the context menu in Finder https://github.com/tsdexter/iCloud-NoSync
The answer that worked for me really well was added as a comment above (https://apple.stackexchange.com/a/335629/117233), but for the sake of being thorough, I thought to add the actual code.
The way it worked for me was the following:
- Delete the folder you don't want to sync (or rename it if the content isn't auto-generated, e.g.
- run the following in the parent directory of the above:
mkdir NAME_OF_FOLDER.nosync && ln -s NAME_OF_FOLDER.nosync NAME_OF_FOLDER
Then copy your content to the
Hope it helps.
You can, if you want to say exclude
node_modules, make a
dir/node_modules in an unsynced folder, move the files there, then create a symlink to that folder where the original node modules were. All code will run the same except iCloud sync which excludes symlinks.
.nosync doesn't work for this because
node_modules must be called
node_modules and should also not ever be synced.