Ignore files with Japanese text in the name?

#1

I have a remote gdrive with some files in it. Some of the files have Kanji in the file names. I don’t care about these files and would rather just leave them where they are instead of copying or syncing to another remote gdrive. Is there an “easy” way to do this because all of the stuff I’ve tried is complicated and doesn’t even work.

I’ve looked at specifying a regex that triggers on any Kanji, and I kind of have that working in regex101.com’s tester… but it does not work in rclone. The pattern \p{Han} should match any Japanese Kanji (according to localizingjapan.com) Is there a way to make this pattern work in rclone to ignore all files that contain Kanji characters?

Example file name I don’t want to copy:
例例例例例例[ABCD1234567890][w12345].rat

Regexs that works in regex testers:
\p{Han}* matches 例 and it also matches 例 例 例 例 例 例 例 例
\p{Han}[.][w.*].rat

I’ve tried both of the regexs above with numerous iterations of escaping certain characters. I tried with an escape “” before each {, }, [, and ]. I did try to escape the “.” but it looks like rclone does that already, so I stopped escaping that character. rclone also appears to place a ^ and $ around the file name, which is mostly fine… but what if my file name starts with standard text and has spaces in it, like this:

Example Example 2019 - rebuild 例 例 例 例 例 例[ABCD1234567890][w12345].rat

This is beginning to ramble on a bit. All I want is to ignore files that have Kanji in them. Does anyone have solution? If you can integrate my filenames specifically, I’d really appreciate it, but I would love to know if this is even possible.

0 Likes

#2

The filters aren’t regexps they are glob style pattern matches. However things in [] are passed directly to the regexp engine so you can put regexp syntax in there.

I think this will probably work --exclude '*[\p{Han}]*'

0 Likes

#3

Thanks, Nick. this was helpful. Thank your for your service.

1 Like

#4

I was able to finally get this working the way I intended. I use --exclude-from and then put this in the file

I love rclone

2 Likes