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.
I created this Automator workflow to do it from the context menu in Finder https://github.com/tsdexter/iCloud-NoSync
.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.
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.