Find destination folder automatically based on filenames at upload to ftp_v2

What is the problem you are having with rclone?

Continue of this thread, cos it closed.

Rclone or regex filter does not filter out, and does not copy/upload filenames contains special charachters.

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

rclone v1.60.1

  • os/version: darwin 10.15.7 (64 bit)

  • os/kernel: 19.6.0 (x86_64)

  • os/type: darwin

  • os/arch: amd64

  • go/version: go1.19.3

  • go/linking: dynamic

  • go/tags: cmount

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

ftp

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


'' uesr@user ~ % rclone ls /Users/user/Desktop/TXT 
      6148 .DS_Store
       10 50321_NEW_XXXXXX.txt
       10 51124+_NEW_XXXXX.txt
       10 51124_XXXXX.txt
       10 53413@_XXXXX.txt
       10 53413_XXXXX.txt
       10 53414_XXXXX.txt
       10 53417_XXXXX.txt

       uesr@user ~ % rclone ls /Users/user/Desktop/TXT  --include='{{\d11\d\d_.*.txt}}'
       10 51124_XXXXX.txt ''


The rclone config contents with secrets removed.




#### A log from the command with the `-vv` flag  
<!-- You should use 3 backticks to begin and end your paste to make it readable.  Or use a service such as https://pastebin.com or https://gist.github.com/   -->

Paste log here

This looks like the correct output to me.

What is the problem?

Shouldn't this file have been filtered out as well?
51124+_NEW_XXXXX.txt

And it doesn't even filter files that have @. (obviously for the -- Inculde='{{\d34\d\d_.*.txt}'

No, check this:

You can troubleshoot using this: https://regex101.com/

1 Like

Your regexp says \d11\d\d_.*.txt which says digit digit 1 1 digit digit underscore.

The above has a + sign before the underscore so it doesn't match.

Same reason.

Maybe you are looking for \d11\d\d.?_.*.txt which optionally allows any character before the underscore.

1 Like

I just checked your initial post and guess you are just looking for something simple like this:

rclone ls /Users/user/Desktop/TXT  --include='{{\d11.*}}'

and probably can do with something much simpler and easier to understand like this:

rclone ls /Users/user/Desktop/TXT  --include='?34*'

The last command will match any filename with 3 as 2nd character and 4 as 3rd character, and ignores anything else.

Explanation:

?         matches any single non-separator (/) character
*         matches any sequence of non-separator (/) characters

More info here: https://rclone.org/filtering/#pattern-syntax

Thank's to all of you!

2 Likes

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