How to include/glob folders?

This has been asked before, but usually it was related to more complex cases - how do you glob folders? For example:

remote1:/folder1_a
remote1:/folder1_b
remote1:/folder2_a

Can you run rclone move remote1: --include "folder1_*" remote2: to move only these two folders that match this glob pattern? It doesn't seem to work. How can you glob folders?

Apologies if this has been mentioned in the docs already, but I really couldn't find it.

The rclone config contents with secrets removed.

[gdrive]
type = drive
client_id = 
client_secret = 
scope = drive
token = 
root_folder_id = 
team_drive = 

The command you were trying to run

rclone move remote1: --include "folder1_*" remote2:

Which cloud storage system are you using?

Google Drive

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

rclone v1.62.2
- os/version: arch "rolling" (64 bit)
- os/kernel: 6.3.4-arch2-1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.4
- go/linking: dynamic
- go/tags: none

A log from the command with the -vv flag

that should be include
and please, answer all the questions in the help and support template

1 Like

Apologies again for skipping the template. Is it necessary to include the log from -vv flag? It contains a lot of personal information. Please let me know if it's necessary and I'll add it.

Thanks again, it would be really helpful to solve this.

rclone ls remote: --include="folder1_*/**"

1 Like

https://rclone.org/filtering/#directory_filter

1 Like

I see, thank you very much. It made the transfer to work now! Much appreciated :slight_smile:

Can I ask you additionally if you think that it would make sense to open an issue on github to request new globbing patterns? I'm relieved that this finally works, but usually when working with shells on unix you could run rclone move 'remote1:folder1_*' remote2: Do you think that there would be any interest in adding such "syntactic sugar"?

Thank you, I did see this page and read it, but I couldn't understand it. Your example made it perfectly clear though.

sure, open a github issue but first some history.

in the past, rclone only supports globs, then i found a bug that enabled regex.
then, based on that, rclone officially added support for regex.

https://forum.rclone.org/t/rclone-copy-using-regex-expression-using-include-multiple-expression-for-file-name/26846/15
which lead to
https://github.com/rclone/rclone/pull/5700
https://forum.rclone.org/t/full-support-for-regex-for-filters/26883/1

1 Like

Thank you for compiling this. I assumed that there must have been a good reason for it. I will mention these links then.

Sorry, but there was a problem with the previous command. Instead of moving the files it copied them. Is it something that you might have seen before? It did correctly glob selected folders, but it didn't delete them after operation was finished.

perhaps --delete-empty-src-dirs Delete empty source dirs after move

Apologies, please ignore my last comment - move command worked fine. I'm just an idiot and looked at a wrong folder :lying_face:

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