# Move folders starting with \[

**URL:** <https://forum.rclone.org/t/move-folders-starting-with/36262>\
**Category:** Help and Support\
**Created:** [February 20, 2023, 8:26pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262 "2023-02-20T20:26:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![InfoR3aper](https://forum.rclone.org/user_avatar/forum.rclone.org/infor3aper/32/10700_2.png) [@InfoR3aper](https://forum.rclone.org/u/InfoR3aper)\
**Post date:** [February 20, 2023, 8:26pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/1 "2023-02-20T20:26:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [February 20, 2023, 8:28pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/2 "2023-02-20T20:28:44Z")

</div>

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

What OS are you running?

What version of rclone?

> **[Rclone Filtering](https://rclone.org/filtering/)**
>
> Rclone filtering, includes and excludes

is the filtering docs.

---

<div class="post-metadata">

**Author:** ![InfoR3aper](https://forum.rclone.org/user_avatar/forum.rclone.org/infor3aper/32/10700_2.png) [@InfoR3aper](https://forum.rclone.org/u/InfoR3aper)\
**Post date:** [February 20, 2023, 8:40pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/3 "2023-02-20T20:40:15Z")

</div>

#### 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`)

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

```

#### The rclone config contents with secrets removed.

```auto
[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

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

```

I looked at

> **[Filter pattern examples - Rclone Filtering](https://rclone.org/filtering/#examples)**
>
> Filter flags determine which files rclone sync, move, ls, lsl, md5sum, sha1sum, size, delete, check and similar commands apply to. | Rclone filtering, includes and excludes

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

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [February 20, 2023, 8:43pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/4 "2023-02-20T20:43:05Z")

</div>

I'd assume Windows works the same.

For special characters, use a backslash.

```auto
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

```

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 20, 2023, 8:46pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/5 "2023-02-20T20:46:19Z")

</div>

> [@Animosity022](#):
>
> Windows work the same.

almost the same 😉

```auto
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

```

---

<div class="post-metadata">

**Author:** ![InfoR3aper](https://forum.rclone.org/user_avatar/forum.rclone.org/infor3aper/32/10700_2.png) [@InfoR3aper](https://forum.rclone.org/u/InfoR3aper)\
**Post date:** [February 20, 2023, 8:50pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/6 "2023-02-20T20:50:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [February 20, 2023, 8:52pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/7 "2023-02-20T20:52:55Z")

</div>

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.

> **[Rclone Filtering](https://rclone.org/filtering/#patterns)**
>
> Rclone filtering, includes and excludes

---

<div class="post-metadata">

**Author:** ![InfoR3aper](https://forum.rclone.org/user_avatar/forum.rclone.org/infor3aper/32/10700_2.png) [@InfoR3aper](https://forum.rclone.org/u/InfoR3aper)\
**Post date:** [February 20, 2023, 8:56pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/8 "2023-02-20T20:56:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [March 22, 2023, 8:57pm UTC](https://forum.rclone.org/t/move-folders-starting-with/36262/9 "2023-03-22T20:57:02Z")

</div>

Closed on March 22, 2023, 8:57pm UTC

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