Is it possible to include the directory itself in a union, instead of it's contents?

What is the problem you are having with rclone?

I have two remotes, gdrive: and dropbox:
gdrive: has 2 directories, gdrive:/dir1 and gdrive:/dir2
dropbox: has 2 other directories, dropbox:/dir2 and dropbox:/dir3

What I would like to do is create a union that contains only gdrive:/dir1 and dropbox:/dir2.
The issue that I'm seeing is if I specify the directories in this way, then it unions the contents of those directories, if I don't specify the direcotires, then it unions everything in the two remotes, but I don't want the two dir2 folders merged, and I also see dir3 which I don't want.

I tried listing the directories in the union command with and without trailing slashes, to see if that makes any difference (in the same way rsync treats trailing slashes as the contents of a directory, and without the slash to mean the directory itself.)

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

rclone v1.62.2

  • os/version: ubuntu 22.04 (64 bit)
  • os/kernel: 5.15.0-71-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.20.2
  • go/linking: static
  • go/tags: none

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

Google Drive and Dropbox

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

rclone mount union /mnt/uniontest

The rclone config contents with secrets removed.

[gdrive]
type = drive
client_id = XXXXXXXXXX
client_secret = XXXXXXXXXX
scope = drive.file
root_folder_id = root
service_account_file =
token = XXXXXXXXXX
team_drive =

[dropbox]
type = dropbox
token = XXXXXXXXXX

[gdrive-crypt]
type = crypt
remote = gdrive:/crypt
filename_encryption = standard
directory_name_encryption = true
password = XXXXXXXXXX
password2 =

[dropbox-crypt]
type = crypt
remote = dropbox:crypt
filename_encryption = standard
directory_name_encryption = true
password = XXXXXXXXXX
password2 =

[union]
type = union
upstreams = gdrive-crypt:/dir1 dropbox-crypt:/dir2

Union does what its name says... union

Check:

Maybe this is what you need.

[combine]
type = combine
upstreams = dir1=gdrive-crypt:dir1 dir2=dropbox-crypt:dir2

Ah amazing, I didn't know Combine was an option. That solves my issue perfectly.

Thanks for your help.

1 Like

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