Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

docs for --exclude-if-present

Iakov Davydov429bb7e8b837
diff --git a/docs/content/filtering.md b/docs/content/filtering.md
index 4a4c4bbaa..19c2c23f0 100644
--- a/docs/content/filtering.md
+++ b/docs/content/filtering.md
@@ -421,3 +421,24 @@ In Windows the expansion is done by the command not the shell so this
should work fine
* `--include *.jpg`
+
+## Exclude directory based on a file ##
+
+It is possible to exclude a directory based on a file, which is
+present in this directory. Filename should be specified using the
+`--exclude-if-present` flag. This flag has a priority over the other
+filtering flags.
+
+Imagine, you have the following directory structure:
+
+ dir1/file1
+ dir1/dir2/file2
+ dir1/dir2/dir3/file3
+ dir1/dir2/dir3/.ignore
+
+You can exclude `dir3` from sync by running the following command:
+
+ rclone sync --exclude-if-present .ignore dir1 remote:backup
+
+Currently only one filename is supported, i.e. `--exclude-if-present`
+should not be used multiple times.