Move folders starting with [

I did not fill out the form since I believe this is a generic question in general

I am trying to move folders that start with the [ character.

Since this appears to be a regex code is there a way using includes to do this..
'''
--include="/[A**"
--include="/[B**"
'''

Very curious if there is a way to do this.

The template really is helpful as we have to ask questions..

What OS are you running?

What version of rclone?

is the filtering docs.

What is the problem you are having with rclone?

Trying to move directories starting with
[

I do not understand how in regex to make it understand [ is a directory starting Character

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

rclone v1.61.1

  • os/version: Microsoft Windows Server 2022 Datacenter 21H2 (64 bit)
  • os/kernel: 10.0.20348.1547 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.19.4
  • go/linking: static
  • go/tags: cmount

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

Google Drive

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

rclone -vP  --dry-run --include="/[A**" move BOT:/SPECIAL/ Special-A:/00/ --config=drives.conf

The rclone config contents with secrets removed.

[BOT]
type = drive
scope = drive
service_account_file = workfilez-sa\1006.json
team_drive = 
server_side_across_configs = true

[Special-A]
type = drive
scope = drive
service_account_file = workfilez-sa\1398.json
team_drive = 
server_side_across_configs = true

A log from the command with the -vv flag

2023/02/20 20:38:46 Failed to load filters: mismatched '[' and ']' in glob "[A**"

I looked at

But cannot figure out the syntax, I am "horrible" with regex

I'd assume Windows works the same.

For special characters, use a backslash.

felix@gemini:~/test$ rclone ls /home/felix/test
        0 [ATest]/testing
        0 One/onetest
        0 Two/twotest
felix@gemini:~/test$ rclone ls /home/felix/test --include '\[A**'
        0 [ATest]/testing

almost the same :wink:

rclone ls d:\files\zork
        0 [A/A.txt
        0 [B/B.txt
        0 C/C.txt

rclone ls d:\files\zork\ --include='\[A**'

rclone ls d:\files\zork\ --include="\[A**"
        0 [A/A.txt

Yes the backslash worked, is that the regex escape character? Meaning if a directory starts with a special character like [{ etc rclone ignores the regex part?

Asking because
'''
--include="/A**"
--include="/[Aa**"
'''

works just fine on windows. So I am assuming the backslash means something different with rclone command, if that makes sense.

Generally if you have a reserved / special character, you have to backslash so the shell knows to not interpret it.

It's not unique to a regex but generally any command that has reserved/special characters that mean something to that command.

The [ is part of a the pattern matching for rclone's filtering and rclone filtering is like a regex, but not exactly the same.

Thank you very much, huge help a huge amount of time!

I will do more reading on the filtering a lot I do get, but I always have issue with regex related commands.

Thanks again

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