Destination DIR deleted on using --exclude-if-present flag

What is the problem you are having with rclone?

if I have a directory tree like this both in local and remote

dir1/
dir1/file1.txt
dir1/dir2/
dir1/dir2/file2.txt

Now I want rlone to simply exclude the dir1 during sync from tracking any modification either in remote or local. So I use the flag --exclude-if-present .rcignoredir add a file in the tree.

dir1/.rcignoredir

Now during sync, rclone in an attempt to exclude the directory, it deletes the entire dir1 tree in the remote/destination. I expected it not to delete anything from destination, but simply ignore any changes in dir1 on both sides.

I know I can do this with --exclude /dir1 flag, which also works as I expected, i.e ignoring dir1 from sync without deleting anything from remote.

So, I find this behavior inconsistent between --exclude-if-present flag and all other filterings flags (https://rclone.org/filtering/). For other flags, what I understand, rclone will only delete files from remote ONLY if I enable --delete-excluded additionally.

What is your rclone version (output from rclone version)

rclone v1.51.0
- os/arch: linux/amd64
- go version: go1.13.7

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux

Which cloud storage system are you using? (eg Google Drive)

Irrespective of any storage. But I am using SFTP

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync  --checksum /local/dir/ remote: --exclude-if-present .rcignoredir

The rclone config contents with secrets removed.

I think it's not needed

A log from the command with the -vv flag

2020/08/21 21:19:16 DEBUG : rclone: Version "v1.51.0" starting with parameters ["rclone" "--config" "rclone.conf" "sync" "-P" "-vv" "--checksum" "./" "remote:" "--exclude" ".rcfilter" "--filter-from" ".rcfilter" "--exclude-if-present" ".rcignoredir" "--exclude" "upload_site.sh"]
2020/08/21 21:19:16 DEBUG : Using RCLONE_CONFIG_PASS password.
2020/08/21 21:19:16 DEBUG : Using config file from "rclone.conf"
2020/08/21 21:19:18 DEBUG : --removed-- to "SSH-2.0-OpenSSH_4.3"
2020-08-21 21:19:19 DEBUG : .rcfilter: Excluded
2020-08-21 21:19:19 DEBUG : dir1: Excluded
2020-08-21 21:19:19 DEBUG : upload_site.sh: Excluded
2020-08-21 21:19:23 DEBUG : .ftpquota: Excluded
--- REMOVED ----
2020-08-21 21:20:07 INFO  : --removed--: Waiting for transfers to finish
2020-08-21 21:20:07 INFO  : Waiting for deletions to finish
2020-08-21 21:20:07 INFO  : dir1/file1.txt: Deleted
2020-08-21 21:20:07 INFO  : dir1/dir2/file2.txt: Deleted
2020-08-21 21:20:07 DEBUG : dir1/dir2: Removing directory
2020-08-21 21:20:09 DEBUG : dir1: Removing directory
2020-08-21 21:20:10 DEBUG : --removed--: deleted 2 directories
Transferred:             0 / 0 Bytes, -, 0 Bytes/s, ETA -
Checks:               367 / 367, 100%
Deleted:                2
Elapsed time:        44.2s
2020/08/21 21:20:10 INFO  :
Transferred:             0 / 0 Bytes, -, 0 Bytes/s, ETA -
Checks:               367 / 367, 100%
Deleted:                2
Elapsed time:        44.2s

2020/08/21 21:20:11 DEBUG : 147 go routines active
2020/08/21 21:20:11 DEBUG : rclone: Version "v1.51.0" finishing with parameters ["rclone" "--config" "rclone.conf" "sync" "-P" "-vv" "--checksum" "./" "remote:" "--exclude" ".rcfilter" "--filter-from" ".rcfilter" "--exclude-if-present" ".rcignoredir" "--exclude" "upload_site.sh"]

I think this looks like a bug, or at minimum something which should be mentioned in the docs.

Can you file an issue on GitHub about this please and post the link here for future searchers - thanks

Also, unrelated maybe, that is a lot of go routines to have active at the end, maybe indicative of a bug .

What is your source and destination remotes?

Thanks for your reply.

I have opened an issue at Github: https://github.com/rclone/rclone/issues/4523

The source is just a local directory, and the destination is SFTP.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.