How to use --filter for skip backup thumbnail photos in wordpress

Hi all
I tried using some regular expression with filter of rclone sync/ copy upload wordpress photos to cloud but it can't match and skip correct file as i want.
example i have some photos file on folder wordpress upload:
a. photo-abc-original.jpg (original) - copy this file
b. photo-abc-original-1.jpg (original) - copy this file
c. photo-abc-original-9.jpg (original) - copy this file
d. photo-abc-original-180x250.jpg (thumbnail file) - skip copy this file
e. photo-abc-original-380x550.jpg (thumbnail file) - skip copy this file

  1. rclone sync --filter "- /-\d+x\d+.(?:png|jpe?g|bmp|tiff|gif)$/" source:path dest:path
    or rclone sync --exclude "/-\d+x\d+.(?:png|jpe?g|bmp|tiff|gif)$/" source:path dest:path
    it can't match and copy/ sync all photos to cloud

  2. rclone sync --filter "- *[\d].{jpg,png,bmp,tiff,gif}" source:path dest:path
    it will skip all photo file exclude file a. (lost b., c.)


    How to using correct regular express "/-\d+x\d+.(?:png|jpe?g|bmp|tiff|gif)$/" with rclone?
    Please help me resolve this problem.
    Thanks all

The filters aren't regular expressions, they are file globs like bash uses.

So you probably want to use a filter something like this which is probably near enough right.

*[0-9]x[0-9]*.{png,jpeg,jpg,bmp,tiff,gif}

They aren't quite as expressive as regular expressions, but they are much easier to read.

1 Like

Thanks for your support
rclone sync --filter "- [0-9]x[0-9].{png,jpeg,jpg,bmp,tiff,gif}" working OK

1 Like

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