Filter files in an rclone transfer
Exclude files with rclone rules, inspect selected paths, dry-run a Dosya WebDAV copy and verify bytes without accidental sync deletion.
Last reviewed
Use rclone filters to leave backup files, temporary folders or unwanted extensions out of a transfer. First list the selected paths, then preview copy with the identical rules. A filter narrows a client command; it does not restrict what a stolen Dosya credential can access.

Before you start
The examples upload the contents of ./sample-source into an existing filter-checks folder through a WebDAV remote named dosya-webdav. Create a harmless source tree with report.pdf, draft.bak, tmp/cache.txt and photos/photo.jpg; choose a destination that contains no important files.
To configure a fresh remote, create a key in Profile → API keys → New API key. Choose Full access, select your Workspace, and under Restrictions and expiry → Protocols → Only the ones I pick, permit WebDAV. Save the full dos_… key when you generate it. In Integrations → WebDAV, copy the entire HTTPS mount URL. Run rclone config, choose a new webdav remote, Vendor other, that URL, your key owner’s email as User and the API key in the hidden Password prompt. Keep the configuration private: rclone’s obscured password is reversible.
A normal mount lists six collections; write through All, not a smart view such as Images. For a folder-anchored key, the selected folder’s children are already the root: replace dosya-webdav:All/filter-checks below with dosya-webdav:filter-checks. Create that destination first in Files or with rclone mkdir. Key permissions and your workspace role must both permit WebDAV and the transfer; selecting Full access cannot widen your role.
Steps: exclude files and preview the transfer
- Confirm the two paths. The first copy argument is the source; the second receives the files. For a download, reverse them and choose an empty local target. These examples never use
sync. - List the selected source files. Repeated
--excludeoptions omit.bakfiles anywhere and the top-leveltmpsubtree:
rclone lsf ./sample-source --recursive --files-only --exclude '*.bak' --exclude '/tmp/**'
Expect report.pdf and photos/photo.jpg from the sample tree. No draft.bak or tmp/cache.txt should appear. A leading / anchors the rule at the source argument’s root; /tmp/** does not exclude photos/tmp/cache.txt. ** crosses directory separators, whereas * stays within a path segment. Use forward slashes in patterns on every platform. Matching is case-sensitive unless you deliberately add --ignore-case.
- Preview without writing. Keep exactly those filters:
rclone copy ./sample-source dosya-webdav:All/filter-checks --exclude '*.bak' --exclude '/tmp/**' --dry-run -vv
Read the planned paths and any errors. A dry run can contact/list the destination but does not upload the planned files; its simulated transferred counters are not proof that bytes arrived. If an unexpected filename is selected, fix the rule and repeat the listing and preview.
- Run the checked copy. Remove only
--dry-runand retain the paths/rules:
rclone copy ./sample-source dosya-webdav:All/filter-checks --exclude '*.bak' --exclude '/tmp/**' --progress
Quote patterns so the shell passes the wildcard to rclone. Single quotes work for these examples in POSIX shells and PowerShell; use double quotes in Windows Command Prompt. Do not write dosya-webdav:*.pdf as a substitute for a filter.
Include selected types or order mixed rules
For PDFs only, use an include family on its own:
rclone lsf ./sample-source --recursive --files-only --include '*.pdf'
--include adds a final exclude-all rule implicitly. When you need both allowed types and exceptions, use only the filter family, rather than mixing --include, --exclude and --filter. Create transfer.rules outside the source tree with this content:
# Drop private and temporary material before allowing document types.
- /private/**
- *.bak
+ *.pdf
+ *.jpg
- **
Rules run top to bottom; the first match wins. + *.pdf alone does not reject everything else, so the explicit final - ** is essential here. Whole-line # and ; comments are supported; an inline comment becomes part of the pattern. Keep the same file throughout the workflow:
rclone lsf ./sample-source --recursive --files-only --filter-from ./transfer.rules
rclone copy ./sample-source dosya-webdav:All/filter-checks --filter-from ./transfer.rules --dry-run -vv --dump filters
rclone copy ./sample-source dosya-webdav:All/filter-checks --filter-from ./transfer.rules --progress
rclone check ./sample-source dosya-webdav:All/filter-checks --filter-from ./transfer.rules --one-way --download
For the sample tree, that rule file selects report.pdf and photos/photo.jpg. check --download reads bytes to compare them and consumes download allowance. --one-way checks source-selected files without demanding that the destination have no extras. An exit status of zero plus the expected candidate list and successful byte check establish this filtered copy’s result; a nonzero status needs investigation.
Expected result and deletion risks
Only the files your checked rules select are copied. Excluded local files remain on your computer, and ordinary copy does not delete destination-only objects. Matching destination names can still be replaced when rclone decides a transfer is needed; Dosya writes a new file version, with finite history retention, rather than guaranteeing permanent recovery.
If you change the command to sync, destination files inside its selected scope can be deleted to match the source. Normally excluded destination paths are protected from sync deletion; --delete-excluded removes that protection and can delete the very files your filters hide. rclone purge ignores filters. Do not use either as a shortcut to clean this test. Remote deletion moves eligible files to Trash and revokes their share links; local destination deletion has no Dosya Trash recovery.
Troubleshooting
Nothing is selected. Check the root-relative slash, filename case and whether you accidentally matched only a directory (/photos/) instead of its files (/photos/**). --dump filters -vv shows the applied rules; do not change transfer direction while debugging patterns.
An exception is ignored. Put the exclusion before the broader inclusion in a filter file. Mixing filter families does not preserve your visual command-line order; convert the command to one --filter-from file.
403, Locked, or a quota refusal. Filters do not bypass role/key restrictions, locked destinations, blocked extensions or storage allowance. WebDAV upload requires Content-Length and an existing parent folder. For a 429, respect Retry-After and reduce client concurrency; multiple GET range streams may require --multi-thread-streams 0 as well as --transfers 1 when downloading.
Related guides
Was this helpful?
Loading helpfulness results…
Voting saves a necessary ballot cookie for up to 180 days so you can change your answer.
Questions and replies
Ask about the steps in this guide. Questions are reviewed before publication.
Keep account details, credentials and private files out of public questions. Use private support for those.
Loading questions…
Sign in to your Dosya account to ask a question.