Using filters to determine which folders are uploaded. Possible?

eg 1TB of mixed folders and I only want to upload the folders which include 'client' .. and all subfolders within any parent folder named 'client'.

Can that be achieved using Rclone?

--include client/** will include any client folders and the things under them.

It won't include the folder that the client directory is in though - did you need that? If so then that is currently beyond rclone's powers! You'd have to write a script to find all the directories then pass them into an --include-from directive probably.

Something like this

find /path/to/source -name client -type d -printf "/%P\n" | sed 's/\/client$/\/**/' > include-from
rclone copy /path/to/source remote:whatever --include-from include-from

How would I include any folders that contain the word 'client', rather than a folder specifically named 'client'?

Have tried:
.client/**
/.client/

But neither work.

The folders I want to match are client.memo, client.presentation, etc

Something like:

--include /**client**/**

For some reason that doesn't work

--π—Άπ—»π—°π—Ήπ˜‚π—±π—² .π—°π—Ήπ—Άπ—²π—»π˜. works, but matches literally every single file and folder - including files in other folders.
--include /client/** doesn't work at all

Any other ideas?

I literally want to match only folders which contain the word 'client' and all subfolders and files.

Is there a reason you aren't trying what I recommended?

Sorry - the forum is formatting the **

That's why they don't show when I posted them above

I have tried exactly as you suggested.

How do I post as you did, to avoid the double asterisk being formatted as bold?

If you want to put something like a command, use three backticks `

rclone ls ~/Downloads/T
      250 client.test/hosts
      250 client.memo/hosts
      250 1/hosts
      250 2/client.blah/hosts

with include.

rclone ls --include /**client**/** ~/Downloads/T
      250 client.test/hosts
      250 client.memo/hosts
      250 2/client.blah/hosts

:slight_smile:

--π—Άπ—»π—°π—Ήπ˜‚π—±π—² **.π—°π—Ήπ—Άπ—²π—»π˜.** works, but matches literally every single file and folder - including files in other folders.
--π—Άπ—»π—°π—Ήπ˜‚π—±π—² /**π—°π—Ήπ—Άπ—²π—»π˜**/** doesn't work at all.

Can you give an example of your structure and command you are running as I showed you with output above it works so your use case is different or I'm not understanding what you are trying to do.

rclone copy --include /**client**/** I:\ crypt:/_test --transfers 10 -v -P --dry-run

Gives: ERROR : System Volume Information: failed to open directory "System Volume Information": open \?\I:

But oddly, rclone copy --include **.client.** I:\ crypt:/_test --transfers 10 -v -P --dry-run gives:

Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors: 1 (no need to retry)
Checks: 0 / 0, -
Transferred: 8797 / 8797, 100%
Elapsed time: 23.4s

Just run a rclone ls and use the includes or without them so we can see your directory structure and what is or is not working. Without any output, it's really tough man.

There is no structure yet ... it's a brand new drive with a simple '_test' folder

I'm confused.

You don't have a source set of directories you are trying to copy up using rclone?

run rclone ls on the source you are trying to filter, share the output and we can make sure the filter works.

For some reason, one of the asterisks was missing from when I copied your initial /**.client.**/**. You were correct - it works! :slightly_smiling_face:

Thank you

I'm now trying to exclude all/any folder named 'System Volume Information'

rclone copy --exclude System Volume Information/** --include /**.client.**/** J:\ crypt:/_test --transfers 10 -v -P

But that is erroring out as follows:

'Command copy needs 2 arguments maximum: you provided 4 non flag arguments: ["Volume" "Information/**" "J:\" "crypt:/_test"]

How can I exclude that folder permanently?

You shouldn't use include and exclude together:

https://rclone.org/filtering/#adding-filtering-rules

The issue with your command is that you have spaces. So back again, if you have a listing of your source and what you are trying to do, that helps as piecing each step together makes the whole thing tougher / longer and we end up with wrong solutions.

You want to use a filter-from file instead so you can order your items:

https://rclone.org/filtering/#filter-from-read-filtering-patterns-from-a-file

rclone ls J: returns the following:

3082 client2/LinuxInt-outline_220-97.jpg
3082 client/LinuxInt-outline_220-97.jpg
129 $RECYCLE.BIN/S-1-5-21-1950850095-3909511788-1387171241-1001/desktop.ini

It doesn't even 'see' the System Volume Information folder, which is 0 bytes.

You probably want to filter:

--filter "- System Volume Information/**" --filter "+ /**client/**" --filter "- **"

I don't have a Windows machine to test as filtering goes in order so I'm telling it to exclude the System Information Volume, include the client filter . you had before and exclude everything after that.

Perfect

If I incorporate that into a filters.txt, would it be as follows:

- System Volume Information/**
+ /**client/**
- *