How to exclude a directory in a team drive

This is my folder tree.

-SourceteamDriveName
  -testFolder
    -t1
      test.txt
    -t2
      test.txt

I want to copy all files from SourceteamDriveName to another teamDrive but exclude everything present in t1 folder
This is my command

rclone copy "SourceteamDriveName:testFolder" "DestTeamDrive:testFolder" --exclude "SourceteamDriveName:testFolder/t1"

However, it is not working. What am I doing wrong?

hello and welcome to the forum,

filtering can be very confusing.

the exclusion is relative to the root of the source.

--exclude "/testFolder/t1/"

https://rclone.org/filtering/#patterns
" If the pattern starts with a / then it only matches at the top level of the directory tree, relative to the root of the remote"

also, it is easy to make mistakes, you can use the --dry-run when testing.
https://rclone.org/docs/#n-dry-run

Hey. Thank you for your quick reply. I tried as you instructed, however, it is still copying files from both the directory.

i am getting confused,

you posted your rclone command as
rclone copy "SourceteamDriveName:testFolder" "DestTeamDrive:testFolder" --exclude "SourceteamDriveName:testFolder/t1"

and now you have changed it to something else.

what command are you using?
what is the structure of the remote?
what are you trying to exclude?

in the second example, if you are trying to exclude the t1 folder,
--exclude /t1/

Sorry, I myself am confused haha. And thank you, this worked

in the second example, if you are trying to exclude the t1 folder,
`--exclude /t1/`

remember, that the exclusion is relative to the root of the remote.

in the second case,
the remote is TeamDrive:test
not TeamDrive:

glad it worked out

1 Like

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