There is no way using the UI to specify that OneDrive should not sync a specific file, filetype or folder inside the OneDrive folder structure.
3 Answers
Might be a bit late but there was an updated as I posted here.
OneDrive added this feature a short while ago. Well somewhat. If you are using the OneDrive insider preview you can do this:
Copy %LOCALAPPDATA%\Microsoft\OneDrive\{OneDriveVersion}\adm OneDrive.adml (language file) to C:\Windows\PolicyDefinitions\en-US and the OneDrive.admx to C:\Windows\PolicyDefinitions.
Then in the Group Policy Editor (gpedit.msc) go to Computer Configuration -> Administrative Templates -> All Settings and find Exclude specific kinds of files from being uploaded. Now there you can specify specific file types or file names to ignore.
See also https://senpai.club/exclude-file-types/ and https://techcommunity.microsoft.com/t5/microsoft-onedrive-blog/celebrating-the-top-onedrive-moments-from-microsoft-ignite-2020/ba-p/1679821
- 351
Update: Doesn't work anymore ¯\_(ツ)_/¯
Simply make the file both hidden and system, and OneDrive will not sync it. If it has already been synced, you'll also need to delete it online as well.
To make a file hidden and system open a command window and enter the following command:
attrib -A +S +H path\to\file\filename.ext
Note that after this change by default the file or folder will no longer be visible unless you change the relevant windows explorer setting.
- 4,511
There is also a solution for MacOS to ignore file types. I have not yet tested if it works to ignore full folders.
The documentation is here: https://learn.microsoft.com/en-us/sharepoint/deploy-and-configure-on-macos#enableodignore
If I understand it correctly, you have to edit ~/Library/Preferences/com.microsoft.OneDrive.plist, ideally using a PList-aware editor. In this file, you should add a key EnableODIgnore, of type array, and inside the key, you add as string the file patterns to ignore, such as *.txt~.
If you have installed OneDrive from the App Store, the file to edit is ~/Library/Containers/com.microsoft.OneDrive-mac/Data/Library/Preferences/com.microsoft.OneDrive-mac.plist
It works. So far tested on file extension *.heic. Here's the entry in the plist:
$ plutil -convert xml1 -o - com.microsoft.OneDrive.plist | grep -A 3 EnableODIgnore
<key>EnableODIgnore</key>
<array>
<string>*.heic</string>
</array>
And here's what Finder shows for this file:
"Excluded from sync".
Next up, ignoring node_modules
- 130
