github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/docs/content/union.md (about) 1 --- 2 title: "Union" 3 description: "Remote Unification" 4 date: "2018-08-29" 5 --- 6 7 <i class="fa fa-link"></i> Union 8 ----------------------------------------- 9 10 The `union` remote provides a unification similar to UnionFS using other remotes. 11 12 Paths may be as deep as required or a local path, 13 eg `remote:directory/subdirectory` or `/directory/subdirectory`. 14 15 During the initial setup with `rclone config` you will specify the target 16 remotes as a space separated list. The target remotes can either be a local paths or other remotes. 17 18 The order of the remotes is important as it defines which remotes take precedence over others if there are files with the same name in the same logical path. 19 The last remote is the topmost remote and replaces files with the same name from previous remotes. 20 21 Only the last remote is used to write to and delete from, all other remotes are read-only. 22 23 Subfolders can be used in target remote. Assume a union remote named `backup` 24 with the remotes `mydrive:private/backup mydrive2:/backup`. Invoking `rclone mkdir backup:desktop` 25 is exactly the same as invoking `rclone mkdir mydrive2:/backup/desktop`. 26 27 There will be no special handling of paths containing `..` segments. 28 Invoking `rclone mkdir backup:../desktop` is exactly the same as invoking 29 `rclone mkdir mydrive2:/backup/../desktop`. 30 31 Here is an example of how to make a union called `remote` for local folders. 32 First run: 33 34 rclone config 35 36 This will guide you through an interactive setup process: 37 38 ``` 39 No remotes found - make a new one 40 n) New remote 41 s) Set configuration password 42 q) Quit config 43 n/s/q> n 44 name> remote 45 Type of storage to configure. 46 Choose a number from below, or type in your own value 47 [snip] 48 XX / Union merges the contents of several remotes 49 \ "union" 50 [snip] 51 Storage> union 52 List of space separated remotes. 53 Can be 'remotea:test/dir remoteb:', '"remotea:test/space dir" remoteb:', etc. 54 The last remote is used to write to. 55 Enter a string value. Press Enter for the default (""). 56 remotes> 57 Remote config 58 -------------------- 59 [remote] 60 type = union 61 remotes = C:\dir1 C:\dir2 C:\dir3 62 -------------------- 63 y) Yes this is OK 64 e) Edit this remote 65 d) Delete this remote 66 y/e/d> y 67 Current remotes: 68 69 Name Type 70 ==== ==== 71 remote union 72 73 e) Edit existing remote 74 n) New remote 75 d) Delete remote 76 r) Rename remote 77 c) Copy remote 78 s) Set configuration password 79 q) Quit config 80 e/n/d/r/c/s/q> q 81 ``` 82 83 Once configured you can then use `rclone` like this, 84 85 List directories in top level in `C:\dir1`, `C:\dir2` and `C:\dir3` 86 87 rclone lsd remote: 88 89 List all the files in `C:\dir1`, `C:\dir2` and `C:\dir3` 90 91 rclone ls remote: 92 93 Copy another local directory to the union directory called source, which will be placed into `C:\dir3` 94 95 rclone copy C:\source remote:source 96 97 <!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/union/union.go then run make backenddocs --> 98 ### Standard Options 99 100 Here are the standard options specific to union (Union merges the contents of several remotes). 101 102 #### --union-remotes 103 104 List of space separated remotes. 105 Can be 'remotea:test/dir remoteb:', '"remotea:test/space dir" remoteb:', etc. 106 The last remote is used to write to. 107 108 - Config: remotes 109 - Env Var: RCLONE_UNION_REMOTES 110 - Type: string 111 - Default: "" 112 113 <!--- autogenerated options stop -->