Copy folder content except a few sub-folders

In order to replicate the issue, I copied my .ssh folder tree while only keeping two files.

$ mkdir -p ~/ssh/vault/keys
$ cp ~/.ssh/config ~/ssh/
$ cp ~/.ssh/vault/keys/domus_rsa.pub ~/ssh/vault/keys/
$ tree ~/ssh
/Users/N/ssh
├── config
└── vault
    └── keys
        └── domus_rsa.pub

2 directories, 2 files

I create filter_test.txt:

+ /\.gitconfig
+ /\.vimrc
+ /\.zshrc
+ /\.tmux.conf

- /**/.DS_Store

+ /ssh/config
+ /ssh/vault/keys/**

- *

I put in practice filter_test.txt:

$ rclone --filter-from /usr/local/etc/rclone/filter_test.txt sync ~ Safe:/TEST/

I visit folder TEST content:

$ rclone ls Safe:TEST
      387 .gitconfig
     4906 .tmux.conf
     1930 .vimrc
    32405 .zshrc
     2105 ssh/config
      736 ssh/vault/keys/domus_rsa.pub

Now, I create filter_test_2.txt:

- /**/.DS_Store

+ /ssh/{config,vault/keys/**}

- *

I put filter_test_2.txt in practice:

$ rclone lsf -R --filter-from /usr/local/etc/rclone/filter_test_2.txt Safe:/TEST
ssh/
ssh/config
ssh/vault/
ssh/vault/keys/
ssh/vault/keys/domus_rsa.pub

And, it now works! :angry: and I don't understand why. It should have listed everything inside folder TEST.

Let's do something else. Applying filter_test_2.txt to my actual backup folder:

rclone lsf -R --filter-from /usr/local/etc/rclone/filter_test_2.txt Safe:/MBP

Bingo! Complete mess again. The filter is ignored again and all my MBP directory is listed!

So, I don't understand why applying filter_test_2.txt to folder TEST produces expected results and not to MBP folder. I'm completely bewildered. What's inside MBP folder to cause the filter to break? It's a complete mystery!

I create filter_test_3.txt:

- /**/.DS_Store

+ /ssh/config
+ /ssh/vault/keys/**

- *

I put filter_test_3.txt in practice with my real life backup folder:

$ rclone lsf -R --filter-from /usr/local/etc/rclone/filter_test_3.txt Safe:/MBP
ssh/
ssh/config
ssh/vault/
ssh/vault/keys/
ssh/vault/keys/domus_rsa.pub

And it works! So, filter_test_2.txt does not work with my MBP folder.


Do you think such a file could conflict with filter_test_2.txt?

$ rclone ls Safe:MBP/Thinker --include '/.*'
        0 .Icon

I try to delete it, but can't:

$ rclone delete Safe:MBP/Thinker/.Icon
2019/06/06 10:58:12 ERROR : : error listing: directory not found
2019/06/06 10:58:12 ERROR : Attempt 1/3 failed with 2 errors and: directory not found
2019/06/06 10:58:12 ERROR : : error listing: directory not found
2019/06/06 10:58:12 ERROR : Attempt 2/3 failed with 2 errors and: directory not found
2019/06/06 10:58:12 ERROR : : error listing: directory not found
2019/06/06 10:58:12 ERROR : Attempt 3/3 failed with 2 errors and: directory not found
2019/06/06 10:58:12 Failed to delete: directory not found