Guides

Backing up cloud-synced folders without downloading the cloud: --exclude-non-local-files

Backing up a OneDrive or Dropbox folder can download everything the user kept in the cloud. Here is how --exclude-non-local-files prevents that, and what it means for your retention.

If a backup job includes a OneDrive or Dropbox folder, turn on --exclude-non-local-files — but know what it changes before you do. It stops Duplicati from downloading cloud-only files just to back them up, and in exchange those files leave your backup while they stay in the cloud.

OneDrive, Dropbox, iCloud for Windows and other sync clients keep most files as placeholders. The file shows in Explorer with its full name and size, but the content lives with the provider until something opens it. When anything reads a placeholder, Windows quietly downloads the whole file first. A backup program reads every file it backs up, so a first run over a large synced folder can pull down tens or hundreds of gigabytes the user deliberately kept off the disk.

What the option does

Duplicati checks each file's attributes while it scans, before it opens anything. A file or folder carrying any of these Windows attributes is skipped:

Attribute

What it tells Duplicati

Offline

The content has been moved to remote storage

RecallOnOpen

The entry has no local data; opening it fetches it

RecallOnDataAccess

Not fully present; reading it triggers a download

Reading attributes does not trigger a download, so the scan itself stays local. The check also applies to folders: a folder flagged as remote is skipped together with everything inside it. Files the user has opened, or marked Always keep on this device, are local and are backed up as normal.

The skip is logged at verbose level as Excluding path due to attribute filter, so you can always see what was left out and why.

Platform scope. The three attributes above come from the Windows Cloud Files system that OneDrive, Dropbox and iCloud for Windows use. On macOS and Linux, Duplicati only looks for the generic offline flag, which sync clients there do not usually set. Treat the option as a Windows feature for now.

Why turn it on

Without the option, backing up a user profile that contains a synced folder means every placeholder gets downloaded. That causes four problems, and on a managed fleet they arrive on many machines at once:

  • Full disks. Placeholders turn into full files. A 256 GB laptop syncing a 1 TB SharePoint library cannot hold the result, and the backup fails halfway with the disk full.

  • Saturated links. Every endpoint pulls its share of the tenant down at the same time, usually on the first night after the job is deployed.

  • Paying twice. Data already held by Microsoft or Dropbox is downloaded, encrypted and uploaded again to your backup storage.

  • Slow scans. Each recall waits on the provider, so a scan that should take minutes runs for hours.

With the option on, the backup covers what is on the machine and leaves the cloud copy where it is.

The trade-off: cloud-only files look deleted

A skipped file is treated like a file that is no longer there. That matters because a file's state changes without anyone thinking about backup:

  1. A report is opened on Monday, so it is local and Monday's backup includes it.

  2. On Wednesday, Windows Storage Sense or the user's Free up space turns it back into a placeholder.

  3. From Wednesday's backup on, the report is excluded, as if it had been deleted.

  4. Older backup versions still hold it, until your retention policy removes the last version that does.

Nothing is lost on the day the file goes cloud-only. But with a 90-day retention, a file that stays cloud-only for 90 days is gone from the backup, and from then on the provider's copy is the only one.

So the option answers how do I back up this machine without downloading the cloud. It does not answer how is the cloud data protected. A sync client is not a backup: deletions, overwrites and ransomware-encrypted files sync to the provider like any other change.

How to enable it

The option is available from Duplicati 2.3.0.2 onwards. It is off by default.

In the user interface: edit the backup job, go to the Options step, open Advanced options, add exclude-non-local-files and tick it. Save, and the next run applies it.

On the command line: add the flag to the backup command.

duplicati-cli backup <storage-url> "C:\Users\anna\" --exclude-non-local-files=true
duplicati-cli backup <storage-url> "C:\Users\anna\" --exclude-non-local-files=true
duplicati-cli backup <storage-url> "C:\Users\anna\" --exclude-non-local-files=true

Check before you rely on it. test-filters runs the same scan as a backup, including the attribute check, without uploading anything. It lists each path and why it was included or excluded:

duplicati-cli test-filters "C:\Users\anna\OneDrive\" --exclude-non-local-files=true
duplicati-cli test-filters "C:\Users\anna\OneDrive\" --exclude-non-local-files=true
duplicati-cli test-filters "C:\Users\anna\OneDrive\" --exclude-non-local-files=true

Run it once on a machine with a typical mix of local and cloud-only files, and confirm that the files you care about are in the included list.

How it combines with other filters. The option is shorthand for adding the three cloud attributes to --exclude-files-attributes. If you already exclude by attribute, for example Temporary or System, both lists apply. The equivalent long form on Windows is --exclude-files-attributes=Offline,RecallOnOpen,RecallOnDataAccess.

A setup that covers both sides

The clean way to run this is to give each copy of the data one job that is responsible for it:

  1. Endpoint backup with the option on. Duplicati backs up what is on the machine: local folders, application data, and synced files that are present. No surprise downloads, no full disks.

  2. Pin what must always be in the endpoint backup. Mark those folders Always keep on this device in OneDrive or Dropbox. Pinned files stay local, so they stay in scope however the user clears space.

  3. Back up the cloud side at the source. Protect OneDrive, SharePoint and Google Drive with a backup that reads straight from the tenant, such as the managed Microsoft 365 and Google Workspace backup in the Duplicati Console. That copy does not depend on which files happen to be on which laptop.

  4. Verify once, then after changes. Run test-filters when you roll the option out, and again when you change the sync client or its storage policies.

Set up this way, the endpoint backup stays small and fast, and nothing depends on a sync client being a backup.

Get started for free

Pick your own backend and store encrypted backups of your files anywhere online or offline. For MacOS, Windows and Linux.

Pick your own backend and store encrypted backups of your files anywhere online or offline. For MacOS, Windows and Linux.

  • Example image