How to filter files and folders when sync

What is the problem you are having with rclone?

The source directory is GreenTools, with the following structure:
GreenTools
- Unsynced Directory
- rclone
- Synced Directory
。。。。。。
I need to copy all folders in the GreenTools folder except for the "Unsynced Directory" to D:GreenTools. I wrote a bat script in the rclone directory, and its contents are as follows:
rclone sync "../../GreenTools" "../../to" --filter-from exclude.txt

There is also an exclude.txt file in the rclone directory with the following content:

  • ../../GreenTools/Unsynced Directory/**

However, after running the bat file, I found that "Unsynced Directory" was still being synced. Can you please advise me on how to write a filtering file correctly?

Run the command 'rclone version' and share the full output of the command.

rclone v1.62.2

  • os/version: Microsoft Windows 10 Enterprise 21H2 (64 bit)
  • os/kernel: 10.0.19044.1766 Build 19044.1766.1766 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.20.2
  • go/linking: static
  • go/tags: cmount

yes

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

lcoal file

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

rclone.exe ls "..\..\GreenTools" -P --filter-from exclude-file.txt

The rclone config contents with secrets removed.

content of exclude-file.txt is below

- ./同花顺

A log from the command with the -vv flag

Paste  log here

Hi dzhl,

Not sure I fully understand, but seems like your exclude.txt should look like this:

- Unsynced Directory/**

The path of the filter starts in the folder your are pointing at, that is GreenTools.

Thanks,it works

1 Like

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