github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/docs/content/bisync.md (about) 1 --- 2 title: "Bisync" 3 description: "Bidirectional cloud sync solution in rclone" 4 versionIntroduced: "v1.58" 5 status: Beta 6 --- 7 8 ## Bisync 9 `bisync` is **in beta** and is considered an **advanced command**, so use with care. 10 Make sure you have read and understood the entire [manual](https://rclone.org/bisync) (especially the [Limitations](#limitations) section) before using, or data loss can result. Questions can be asked in the [Rclone Forum](https://forum.rclone.org/). 11 12 ## Getting started {#getting-started} 13 14 - [Install rclone](/install/) and setup your remotes. 15 - Bisync will create its working directory 16 at `~/.cache/rclone/bisync` on Linux, `/Users/yourusername/Library/Caches/rclone/bisync` on Mac, 17 or `C:\Users\MyLogin\AppData\Local\rclone\bisync` on Windows. 18 Make sure that this location is writable. 19 - Run bisync with the `--resync` flag, specifying the paths 20 to the local and remote sync directory roots. 21 - For successive sync runs, leave off the `--resync` flag. (**Important!**) 22 - Consider using a [filters file](#filtering) for excluding 23 unnecessary files and directories from the sync. 24 - Consider setting up the [--check-access](#check-access) feature 25 for safety. 26 - On Linux or Mac, consider setting up a [crontab entry](#cron). bisync can 27 safely run in concurrent cron jobs thanks to lock files it maintains. 28 29 For example, your first command might look like this: 30 31 ``` 32 rclone bisync remote1:path1 remote2:path2 --create-empty-src-dirs --compare size,modtime,checksum --slow-hash-sync-only --resilient -MvP --drive-skip-gdocs --fix-case --resync --dry-run 33 ``` 34 If all looks good, run it again without `--dry-run`. After that, remove `--resync` as well. 35 36 Here is a typical run log (with timestamps removed for clarity): 37 38 ``` 39 rclone bisync /testdir/path1/ /testdir/path2/ --verbose 40 INFO : Synching Path1 "/testdir/path1/" with Path2 "/testdir/path2/" 41 INFO : Path1 checking for diffs 42 INFO : - Path1 File is new - file11.txt 43 INFO : - Path1 File is newer - file2.txt 44 INFO : - Path1 File is newer - file5.txt 45 INFO : - Path1 File is newer - file7.txt 46 INFO : - Path1 File was deleted - file4.txt 47 INFO : - Path1 File was deleted - file6.txt 48 INFO : - Path1 File was deleted - file8.txt 49 INFO : Path1: 7 changes: 1 new, 3 newer, 0 older, 3 deleted 50 INFO : Path2 checking for diffs 51 INFO : - Path2 File is new - file10.txt 52 INFO : - Path2 File is newer - file1.txt 53 INFO : - Path2 File is newer - file5.txt 54 INFO : - Path2 File is newer - file6.txt 55 INFO : - Path2 File was deleted - file3.txt 56 INFO : - Path2 File was deleted - file7.txt 57 INFO : - Path2 File was deleted - file8.txt 58 INFO : Path2: 7 changes: 1 new, 3 newer, 0 older, 3 deleted 59 INFO : Applying changes 60 INFO : - Path1 Queue copy to Path2 - /testdir/path2/file11.txt 61 INFO : - Path1 Queue copy to Path2 - /testdir/path2/file2.txt 62 INFO : - Path2 Queue delete - /testdir/path2/file4.txt 63 NOTICE: - WARNING New or changed in both paths - file5.txt 64 NOTICE: - Path1 Renaming Path1 copy - /testdir/path1/file5.txt..path1 65 NOTICE: - Path1 Queue copy to Path2 - /testdir/path2/file5.txt..path1 66 NOTICE: - Path2 Renaming Path2 copy - /testdir/path2/file5.txt..path2 67 NOTICE: - Path2 Queue copy to Path1 - /testdir/path1/file5.txt..path2 68 INFO : - Path2 Queue copy to Path1 - /testdir/path1/file6.txt 69 INFO : - Path1 Queue copy to Path2 - /testdir/path2/file7.txt 70 INFO : - Path2 Queue copy to Path1 - /testdir/path1/file1.txt 71 INFO : - Path2 Queue copy to Path1 - /testdir/path1/file10.txt 72 INFO : - Path1 Queue delete - /testdir/path1/file3.txt 73 INFO : - Path2 Do queued copies to - Path1 74 INFO : - Path1 Do queued copies to - Path2 75 INFO : - Do queued deletes on - Path1 76 INFO : - Do queued deletes on - Path2 77 INFO : Updating listings 78 INFO : Validating listings for Path1 "/testdir/path1/" vs Path2 "/testdir/path2/" 79 INFO : Bisync successful 80 ``` 81 82 ## Command line syntax 83 84 ``` 85 $ rclone bisync --help 86 Usage: 87 rclone bisync remote1:path1 remote2:path2 [flags] 88 89 Positional arguments: 90 Path1, Path2 Local path, or remote storage with ':' plus optional path. 91 Type 'rclone listremotes' for list of configured remotes. 92 93 Optional Flags: 94 --backup-dir1 string --backup-dir for Path1. Must be a non-overlapping path on the same remote. 95 --backup-dir2 string --backup-dir for Path2. Must be a non-overlapping path on the same remote. 96 --check-access Ensure expected RCLONE_TEST files are found on both Path1 and Path2 filesystems, else abort. 97 --check-filename string Filename for --check-access (default: RCLONE_TEST) 98 --check-sync string Controls comparison of final listings: true|false|only (default: true) (default "true") 99 --compare string Comma-separated list of bisync-specific compare options ex. 'size,modtime,checksum' (default: 'size,modtime') 100 --conflict-loser ConflictLoserAction Action to take on the loser of a sync conflict (when there is a winner) or on both files (when there is no winner): , num, pathname, delete (default: num) 101 --conflict-resolve string Automatically resolve conflicts by preferring the version that is: none, path1, path2, newer, older, larger, smaller (default: none) (default "none") 102 --conflict-suffix string Suffix to use when renaming a --conflict-loser. Can be either one string or two comma-separated strings to assign different suffixes to Path1/Path2. (default: 'conflict') 103 --create-empty-src-dirs Sync creation and deletion of empty directories. (Not compatible with --remove-empty-dirs) 104 --download-hash Compute hash by downloading when otherwise unavailable. (warning: may be slow and use lots of data!) 105 --filters-file string Read filtering patterns from a file 106 --force Bypass --max-delete safety check and run the sync. Consider using with --verbose 107 -h, --help help for bisync 108 --ignore-listing-checksum Do not use checksums for listings (add --ignore-checksum to additionally skip post-copy checksum checks) 109 --max-lock Duration Consider lock files older than this to be expired (default: 0 (never expire)) (minimum: 2m) (default 0s) 110 --no-cleanup Retain working files (useful for troubleshooting and testing). 111 --no-slow-hash Ignore listing checksums only on backends where they are slow 112 --recover Automatically recover from interruptions without requiring --resync. 113 --remove-empty-dirs Remove ALL empty directories at the final cleanup step. 114 --resilient Allow future runs to retry after certain less-serious errors, instead of requiring --resync. Use at your own risk! 115 -1, --resync Performs the resync run. Equivalent to --resync-mode path1. Consider using --verbose or --dry-run first. 116 --resync-mode string During resync, prefer the version that is: path1, path2, newer, older, larger, smaller (default: path1 if --resync, otherwise none for no resync.) (default "none") 117 --retries int Retry operations this many times if they fail (requires --resilient). (default 3) 118 --retries-sleep Duration Interval between retrying operations if they fail, e.g. 500ms, 60s, 5m (0 to disable) (default 0s) 119 --slow-hash-sync-only Ignore slow checksums for listings and deltas, but still consider them during sync calls. 120 --workdir string Use custom working dir - useful for testing. (default: {WORKDIR}) 121 --max-delete PERCENT Safety check on maximum percentage of deleted files allowed. If exceeded, the bisync run will abort. (default: 50%) 122 -n, --dry-run Go through the motions - No files are copied/deleted. 123 -v, --verbose Increases logging verbosity. May be specified more than once for more details. 124 ``` 125 126 Arbitrary rclone flags may be specified on the 127 [bisync command line](/commands/rclone_bisync/), for example 128 `rclone bisync ./testdir/path1/ gdrive:testdir/path2/ --drive-skip-gdocs -v -v --timeout 10s` 129 Note that interactions of various rclone flags with bisync process flow 130 has not been fully tested yet. 131 132 ### Paths 133 134 Path1 and Path2 arguments may be references to any mix of local directory 135 paths (absolute or relative), UNC paths (`//server/share/path`), 136 Windows drive paths (with a drive letter and `:`) or configured 137 [remotes](/docs/#syntax-of-remote-paths) with optional subdirectory paths. 138 Cloud references are distinguished by having a `:` in the argument 139 (see [Windows support](#windows) below). 140 141 Path1 and Path2 are treated equally, in that neither has priority for 142 file changes (except during [`--resync`](#resync)), and access efficiency does not change whether a remote 143 is on Path1 or Path2. 144 145 The listings in bisync working directory (default: `~/.cache/rclone/bisync`) 146 are named based on the Path1 and Path2 arguments so that separate syncs 147 to individual directories within the tree may be set up, e.g.: 148 `path_to_local_tree..dropbox_subdir.lst`. 149 150 Any empty directories after the sync on both the Path1 and Path2 151 filesystems are not deleted by default, unless `--create-empty-src-dirs` is specified. 152 If the `--remove-empty-dirs` flag is specified, then both paths will have ALL empty directories purged 153 as the last step in the process. 154 155 ## Command-line flags 156 157 ### --resync 158 159 This will effectively make both Path1 and Path2 filesystems contain a 160 matching superset of all files. By default, Path2 files that do not exist in Path1 will 161 be copied to Path1, and the process will then copy the Path1 tree to Path2. 162 163 The `--resync` sequence is roughly equivalent to the following (but see [`--resync-mode`](#resync-mode) for other options): 164 ``` 165 rclone copy Path2 Path1 --ignore-existing [--create-empty-src-dirs] 166 rclone copy Path1 Path2 [--create-empty-src-dirs] 167 ``` 168 169 The base directories on both Path1 and Path2 filesystems must exist 170 or bisync will fail. This is required for safety - that bisync can verify 171 that both paths are valid. 172 173 When using `--resync`, a newer version of a file on the Path2 filesystem 174 will (by default) be overwritten by the Path1 filesystem version. 175 (Note that this is [NOT entirely symmetrical](https://github.com/rclone/rclone/issues/5681#issuecomment-938761815), and more symmetrical options can be specified with the [`--resync-mode`](#resync-mode) flag.) 176 Carefully evaluate deltas using [--dry-run](/flags/#non-backend-flags). 177 178 For a resync run, one of the paths may be empty (no files in the path tree). 179 The resync run should result in files on both paths, else a normal non-resync 180 run will fail. 181 182 For a non-resync run, either path being empty (no files in the tree) fails with 183 `Empty current PathN listing. Cannot sync to an empty directory: X.pathN.lst` 184 This is a safety check that an unexpected empty path does not result in 185 deleting **everything** in the other path. 186 187 Note that `--resync` implies `--resync-mode path1` unless a different 188 [`--resync-mode`](#resync-mode) is explicitly specified. 189 It is not necessary to use both the `--resync` and `--resync-mode` flags -- 190 either one is sufficient without the other. 191 192 **Note:** `--resync` (including `--resync-mode`) should only be used under three specific (rare) circumstances: 193 1. It is your _first_ bisync run (between these two paths) 194 2. You've just made changes to your bisync settings (such as editing the contents of your `--filters-file`) 195 3. There was an error on the prior run, and as a result, bisync now requires `--resync` to recover 196 197 The rest of the time, you should _omit_ `--resync`. The reason is because `--resync` will only _copy_ (not _sync_) each side to the other. 198 Therefore, if you included `--resync` for every bisync run, it would never be possible to delete a file -- 199 the deleted file would always keep reappearing at the end of every run (because it's being copied from the other side where it still exists). 200 Similarly, renaming a file would always result in a duplicate copy (both old and new name) on both sides. 201 202 If you find that frequent interruptions from #3 are an issue, rather than 203 automatically running `--resync`, the recommended alternative is to use the 204 [`--resilient`](#resilient), [`--recover`](#recover), and 205 [`--conflict-resolve`](#conflict-resolve) flags, (along with [Graceful 206 Shutdown](#graceful-shutdown) mode, when needed) for a very robust 207 "set-it-and-forget-it" bisync setup that can automatically bounce back from 208 almost any interruption it might encounter. Consider adding something like the 209 following: 210 211 ``` 212 --resilient --recover --max-lock 2m --conflict-resolve newer 213 ``` 214 215 ### --resync-mode CHOICE {#resync-mode} 216 217 In the event that a file differs on both sides during a `--resync`, 218 `--resync-mode` controls which version will overwrite the other. The supported 219 options are similar to [`--conflict-resolve`](#conflict-resolve). For all of 220 the following options, the version that is kept is referred to as the "winner", 221 and the version that is overwritten (deleted) is referred to as the "loser". 222 The options are named after the "winner": 223 224 - `path1` - (the default) - the version from Path1 is unconditionally 225 considered the winner (regardless of `modtime` and `size`, if any). This can be 226 useful if one side is more trusted or up-to-date than the other, at the time of 227 the `--resync`. 228 - `path2` - same as `path1`, except the path2 version is considered the winner. 229 - `newer` - the newer file (by `modtime`) is considered the winner, regardless 230 of which side it came from. This may result in having a mix of some winners 231 from Path1, and some winners from Path2. (The implementation is analogous to 232 running `rclone copy --update` in both directions.) 233 - `older` - same as `newer`, except the older file is considered the winner, 234 and the newer file is considered the loser. 235 - `larger` - the larger file (by `size`) is considered the winner (regardless 236 of `modtime`, if any). This can be a useful option for remotes without 237 `modtime` support, or with the kinds of files (such as logs) that tend to grow 238 but not shrink, over time. 239 - `smaller` - the smaller file (by `size`) is considered the winner (regardless 240 of `modtime`, if any). 241 242 For all of the above options, note the following: 243 - If either of the underlying remotes lacks support for the chosen method, it 244 will be ignored and will fall back to the default of `path1`. (For example, if 245 `--resync-mode newer` is set, but one of the paths uses a remote that doesn't 246 support `modtime`.) 247 - If a winner can't be determined because the chosen method's attribute is 248 missing or equal, it will be ignored, and bisync will instead try to determine 249 whether the files differ by looking at the other `--compare` methods in effect. 250 (For example, if `--resync-mode newer` is set, but the Path1 and Path2 modtimes 251 are identical, bisync will compare the sizes.) If bisync concludes that they 252 differ, preference is given to whichever is the "source" at that moment. (In 253 practice, this gives a slight advantage to Path2, as the 2to1 copy comes before 254 the 1to2 copy.) If the files _do not_ differ, nothing is copied (as both sides 255 are already correct). 256 - These options apply only to files that exist on both sides (with the same 257 name and relative path). Files that exist *only* on one side and not the other 258 are *always* copied to the other, during `--resync` (this is one of the main 259 differences between resync and non-resync runs.). 260 - `--conflict-resolve`, `--conflict-loser`, and `--conflict-suffix` do not 261 apply during `--resync`, and unlike these flags, nothing is renamed during 262 `--resync`. When a file differs on both sides during `--resync`, one version 263 always overwrites the other (much like in `rclone copy`.) (Consider using 264 [`--backup-dir`](#backup-dir1-and-backup-dir2) to retain a backup of the losing 265 version.) 266 - Unlike for `--conflict-resolve`, `--resync-mode none` is not a valid option 267 (or rather, it will be interpreted as "no resync", unless `--resync` has also 268 been specified, in which case it will be ignored.) 269 - Winners and losers are decided at the individual file-level only (there is 270 not currently an option to pick an entire winning directory atomically, 271 although the `path1` and `path2` options typically produce a similar result.) 272 - To maintain backward-compatibility, the `--resync` flag implies 273 `--resync-mode path1` unless a different `--resync-mode` is explicitly 274 specified. Similarly, all `--resync-mode` options (except `none`) imply 275 `--resync`, so it is not necessary to use both the `--resync` and 276 `--resync-mode` flags simultaneously -- either one is sufficient without the 277 other. 278 279 280 ### --check-access 281 282 Access check files are an additional safety measure against data loss. 283 bisync will ensure it can find matching `RCLONE_TEST` files in the same places 284 in the Path1 and Path2 filesystems. 285 `RCLONE_TEST` files are not generated automatically. 286 For `--check-access` to succeed, you must first either: 287 **A)** Place one or more `RCLONE_TEST` files in both systems, or 288 **B)** Set `--check-filename` to a filename already in use in various locations 289 throughout your sync'd fileset. Recommended methods for **A)** include: 290 * `rclone touch Path1/RCLONE_TEST` (create a new file) 291 * `rclone copyto Path1/RCLONE_TEST Path2/RCLONE_TEST` (copy an existing file) 292 * `rclone copy Path1/RCLONE_TEST Path2/RCLONE_TEST --include "RCLONE_TEST"` (copy multiple files at once, recursively) 293 * create the files manually (outside of rclone) 294 * run `bisync` once *without* `--check-access` to set matching files on both filesystems 295 will also work, but is not preferred, due to potential for user error 296 (you are temporarily disabling the safety feature). 297 298 Note that `--check-access` is still enforced on `--resync`, so `bisync --resync --check-access` 299 will not work as a method of initially setting the files (this is to ensure that bisync can't 300 [inadvertently circumvent its own safety switch](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=3.%20%2D%2Dcheck%2Daccess%20doesn%27t%20always%20fail%20when%20it%20should).) 301 302 Time stamps and file contents for `RCLONE_TEST` files are not important, just the names and locations. 303 If you have symbolic links in your sync tree it is recommended to place 304 `RCLONE_TEST` files in the linked-to directory tree to protect against 305 bisync assuming a bunch of deleted files if the linked-to tree should not be 306 accessible. 307 See also the [--check-filename](--check-filename) flag. 308 309 ### --check-filename 310 311 Name of the file(s) used in access health validation. 312 The default `--check-filename` is `RCLONE_TEST`. 313 One or more files having this filename must exist, synchronized between your 314 source and destination filesets, in order for `--check-access` to succeed. 315 See [--check-access](#check-access) for additional details. 316 317 ### --compare 318 319 As of `v1.66`, bisync fully supports comparing based on any combination of 320 size, modtime, and checksum (lifting the prior restriction on backends without 321 modtime support.) 322 323 By default (without the `--compare` flag), bisync inherits the same comparison 324 options as `sync` 325 (that is: `size` and `modtime` by default, unless modified with flags such as 326 [`--checksum`](/docs/#c-checksum) or [`--size-only`](/docs/#size-only).) 327 328 If the `--compare` flag is set, it will override these defaults. This can be 329 useful if you wish to compare based on combinations not currently supported in 330 `sync`, such as comparing all three of `size` AND `modtime` AND `checksum` 331 simultaneously (or just `modtime` AND `checksum`). 332 333 `--compare` takes a comma-separated list, with the currently supported values 334 being `size`, `modtime`, and `checksum`. For example, if you want to compare 335 size and checksum, but not modtime, you would do: 336 ``` 337 --compare size,checksum 338 ``` 339 340 Or if you want to compare all three: 341 ``` 342 --compare size,modtime,checksum 343 ``` 344 345 `--compare` overrides any conflicting flags. For example, if you set the 346 conflicting flags `--compare checksum --size-only`, `--size-only` will be 347 ignored, and bisync will compare checksum and not size. To avoid confusion, it 348 is recommended to use _either_ `--compare` or the normal `sync` flags, but not 349 both. 350 351 If `--compare` includes `checksum` and both remotes support checksums but have 352 no hash types in common with each other, checksums will be considered _only_ 353 for comparisons within the same side (to determine what has changed since the 354 prior sync), but not for comparisons against the opposite side. If one side 355 supports checksums and the other does not, checksums will only be considered on 356 the side that supports them. 357 358 When comparing with `checksum` and/or `size` without `modtime`, bisync cannot 359 determine whether a file is `newer` or `older` -- only whether it is `changed` 360 or `unchanged`. (If it is `changed` on both sides, bisync still does the 361 standard equality-check to avoid declaring a sync conflict unless it absolutely 362 has to.) 363 364 It is recommended to do a `--resync` when changing `--compare` settings, as 365 otherwise your prior listing files may not contain the attributes you wish to 366 compare (for example, they will not have stored checksums if you were not 367 previously comparing checksums.) 368 369 ### --ignore-listing-checksum 370 371 When `--checksum` or `--compare checksum` is set, bisync will retrieve (or 372 generate) checksums (for backends that support them) when creating the listings 373 for both paths, and store the checksums in the listing files. 374 `--ignore-listing-checksum` will disable this behavior, which may speed things 375 up considerably, especially on backends (such as [local](/local/)) where hashes 376 must be computed on the fly instead of retrieved. Please note the following: 377 378 * As of `v1.66`, `--ignore-listing-checksum` is now automatically set when 379 neither `--checksum` nor `--compare checksum` are in use (as the checksums 380 would not be used for anything.) 381 * `--ignore-listing-checksum` is NOT the same as 382 [`--ignore-checksum`](/docs/#ignore-checksum), 383 and you may wish to use one or the other, or both. In a nutshell: 384 `--ignore-listing-checksum` controls whether checksums are considered when 385 scanning for diffs, 386 while `--ignore-checksum` controls whether checksums are considered during the 387 copy/sync operations that follow, 388 if there ARE diffs. 389 * Unless `--ignore-listing-checksum` is passed, bisync currently computes 390 hashes for one path 391 *even when there's no common hash with the other path* 392 (for example, a [crypt](/crypt/#modification-times-and-hashes) remote.) 393 This can still be beneficial, as the hashes will still be used to detect 394 changes within the same side 395 (if `--checksum` or `--compare checksum` is set), even if they can't be used to 396 compare against the opposite side. 397 * If you wish to ignore listing checksums _only_ on remotes where they are slow 398 to compute, consider using 399 [`--no-slow-hash`](#no-slow-hash) (or 400 [`--slow-hash-sync-only`](#slow-hash-sync-only)) instead of 401 `--ignore-listing-checksum`. 402 * If `--ignore-listing-checksum` is used simultaneously with `--compare 403 checksum` (or `--checksum`), checksums will be ignored for bisync deltas, 404 but still considered during the sync operations that follow (if deltas are 405 detected based on modtime and/or size.) 406 407 ### --no-slow-hash 408 409 On some remotes (notably `local`), checksums can dramatically slow down a 410 bisync run, because hashes cannot be stored and need to be computed in 411 real-time when they are requested. On other remotes (such as `drive`), they add 412 practically no time at all. The `--no-slow-hash` flag will automatically skip 413 checksums on remotes where they are slow, while still comparing them on others 414 (assuming [`--compare`](#compare) includes `checksum`.) This can be useful when one of your 415 bisync paths is slow but you still want to check checksums on the other, for a more 416 robust sync. 417 418 ### --slow-hash-sync-only 419 420 Same as [`--no-slow-hash`](#no-slow-hash), except slow hashes are still 421 considered during sync calls. They are still NOT considered for determining 422 deltas, nor or they included in listings. They are also skipped during 423 `--resync`. The main use case for this flag is when you have a large number of 424 files, but relatively few of them change from run to run -- so you don't want 425 to check your entire tree every time (it would take too long), but you still 426 want to consider checksums for the smaller group of files for which a `modtime` 427 or `size` change was detected. Keep in mind that this speed savings comes with 428 a safety trade-off: if a file's content were to change without a change to its 429 `modtime` or `size`, bisync would not detect it, and it would not be synced. 430 431 `--slow-hash-sync-only` is only useful if both remotes share a common hash 432 type (if they don't, bisync will automatically fall back to `--no-slow-hash`.) 433 Both `--no-slow-hash` and `--slow-hash-sync-only` have no effect without 434 `--compare checksum` (or `--checksum`). 435 436 ### --download-hash 437 438 If `--download-hash` is set, bisync will use best efforts to obtain an MD5 439 checksum by downloading and computing on-the-fly, when checksums are not 440 otherwise available (for example, a remote that doesn't support them.) Note 441 that since rclone has to download the entire file, this may dramatically slow 442 down your bisync runs, and is also likely to use a lot of data, so it is 443 probably not practical for bisync paths with a large total file size. However, 444 it can be a good option for syncing small-but-important files with maximum 445 accuracy (for example, a source code repo on a `crypt` remote.) An additional 446 advantage over methods like [`cryptcheck`](/commands/rclone_cryptcheck/) is 447 that the original file is not required for comparison (for example, 448 `--download-hash` can be used to bisync two different crypt remotes with 449 different passwords.) 450 451 When `--download-hash` is set, bisync still looks for more efficient checksums 452 first, and falls back to downloading only when none are found. It takes 453 priority over conflicting flags such as `--no-slow-hash`. `--download-hash` is 454 not suitable for [Google Docs](#gdocs) and other files of unknown size, as 455 their checksums would change from run to run (due to small variances in the 456 internals of the generated export file.) Therefore, bisync automatically skips 457 `--download-hash` for files with a size less than 0. 458 459 See also: [`Hasher`](https://rclone.org/hasher/) backend, 460 [`cryptcheck`](/commands/rclone_cryptcheck/) command, [`rclone check 461 --download`](/commands/rclone_check/) option, 462 [`md5sum`](/commands/rclone_md5sum/) command 463 464 ### --max-delete 465 466 As a safety check, if greater than the `--max-delete` percent of files were 467 deleted on either the Path1 or Path2 filesystem, then bisync will abort with 468 a warning message, without making any changes. 469 The default `--max-delete` is `50%`. 470 One way to trigger this limit is to rename a directory that contains more 471 than half of your files. This will appear to bisync as a bunch of deleted 472 files and a bunch of new files. 473 This safety check is intended to block bisync from deleting all of the 474 files on both filesystems due to a temporary network access issue, or if 475 the user had inadvertently deleted the files on one side or the other. 476 To force the sync, either set a different delete percentage limit, 477 e.g. `--max-delete 75` (allows up to 75% deletion), or use `--force` 478 to bypass the check. 479 480 Also see the [all files changed](#all-files-changed) check. 481 482 ### --filters-file {#filters-file} 483 484 By using rclone filter features you can exclude file types or directory 485 sub-trees from the sync. 486 See the [bisync filters](#filtering) section and generic 487 [--filter-from](/filtering/#filter-from-read-filtering-patterns-from-a-file) 488 documentation. 489 An [example filters file](#example-filters-file) contains filters for 490 non-allowed files for synching with Dropbox. 491 492 If you make changes to your filters file then bisync requires a run 493 with `--resync`. This is a safety feature, which prevents existing files 494 on the Path1 and/or Path2 side from seeming to disappear from view 495 (since they are excluded in the new listings), which would fool bisync 496 into seeing them as deleted (as compared to the prior run listings), 497 and then bisync would proceed to delete them for real. 498 499 To block this from happening, bisync calculates an MD5 hash of the filters file 500 and stores the hash in a `.md5` file in the same place as your filters file. 501 On the next run with `--filters-file` set, bisync re-calculates the MD5 hash 502 of the current filters file and compares it to the hash stored in the `.md5` file. 503 If they don't match, the run aborts with a critical error and thus forces you 504 to do a `--resync`, likely avoiding a disaster. 505 506 ### --conflict-resolve CHOICE {#conflict-resolve} 507 508 In bisync, a "conflict" is a file that is *new* or *changed* on *both sides* 509 (relative to the prior run) AND is *not currently identical* on both sides. 510 `--conflict-resolve` controls how bisync handles such a scenario. The currently 511 supported options are: 512 513 - `none` - (the default) - do not attempt to pick a winner, keep and rename 514 both files according to [`--conflict-loser`](#conflict-loser) and 515 [`--conflict-suffix`](#conflict-suffix) settings. For example, with the default 516 settings, `file.txt` on Path1 is renamed `file.txt.conflict1` and `file.txt` on 517 Path2 is renamed `file.txt.conflict2`. Both are copied to the opposite path 518 during the run, so both sides end up with a copy of both files. (As `none` is 519 the default, it is not necessary to specify `--conflict-resolve none` -- you 520 can just omit the flag.) 521 - `newer` - the newer file (by `modtime`) is considered the winner and is 522 copied without renaming. The older file (the "loser") is handled according to 523 `--conflict-loser` and `--conflict-suffix` settings (either renamed or 524 deleted.) For example, if `file.txt` on Path1 is newer than `file.txt` on 525 Path2, the result on both sides (with other default settings) will be `file.txt` 526 (winner from Path1) and `file.txt.conflict1` (loser from Path2). 527 - `older` - same as `newer`, except the older file is considered the winner, 528 and the newer file is considered the loser. 529 - `larger` - the larger file (by `size`) is considered the winner (regardless 530 of `modtime`, if any). 531 - `smaller` - the smaller file (by `size`) is considered the winner (regardless 532 of `modtime`, if any). 533 - `path1` - the version from Path1 is unconditionally considered the winner 534 (regardless of `modtime` and `size`, if any). This can be useful if one side is 535 usually more trusted or up-to-date than the other. 536 - `path2` - same as `path1`, except the path2 version is considered the 537 winner. 538 539 For all of the above options, note the following: 540 - If either of the underlying remotes lacks support for the chosen method, it 541 will be ignored and fall back to `none`. (For example, if `--conflict-resolve 542 newer` is set, but one of the paths uses a remote that doesn't support 543 `modtime`.) 544 - If a winner can't be determined because the chosen method's attribute is 545 missing or equal, it will be ignored and fall back to `none`. (For example, if 546 `--conflict-resolve newer` is set, but the Path1 and Path2 modtimes are 547 identical, even if the sizes may differ.) 548 - If the file's content is currently identical on both sides, it is not 549 considered a "conflict", even if new or changed on both sides since the prior 550 sync. (For example, if you made a change on one side and then synced it to the 551 other side by other means.) Therefore, none of the conflict resolution flags 552 apply in this scenario. 553 - The conflict resolution flags do not apply during a `--resync`, as there is 554 no "prior run" to speak of (but see [`--resync-mode`](#resync-mode) for similar 555 options.) 556 557 ### --conflict-loser CHOICE {#conflict-loser} 558 559 `--conflict-loser` determines what happens to the "loser" of a sync conflict 560 (when [`--conflict-resolve`](#conflict-resolve) determines a winner) or to both 561 files (when there is no winner.) The currently supported options are: 562 563 - `num` - (the default) - auto-number the conflicts by automatically appending 564 the next available number to the `--conflict-suffix`, in chronological order. 565 For example, with the default settings, the first conflict for `file.txt` will 566 be renamed `file.txt.conflict1`. If `file.txt.conflict1` already exists, 567 `file.txt.conflict2` will be used instead (etc., up to a maximum of 568 9223372036854775807 conflicts.) 569 - `pathname` - rename the conflicts according to which side they came from, 570 which was the default behavior prior to `v1.66`. For example, with 571 `--conflict-suffix path`, `file.txt` from Path1 will be renamed 572 `file.txt.path1`, and `file.txt` from Path2 will be renamed `file.txt.path2`. 573 If two non-identical suffixes are provided (ex. `--conflict-suffix 574 cloud,local`), the trailing digit is omitted. Importantly, note that with 575 `pathname`, there is no auto-numbering beyond `2`, so if `file.txt.path2` 576 somehow already exists, it will be overwritten. Using a dynamic date variable 577 in your `--conflict-suffix` (see below) is one possible way to avoid this. Note 578 also that conflicts-of-conflicts are possible, if the original conflict is not 579 manually resolved -- for example, if for some reason you edited 580 `file.txt.path1` on both sides, and those edits were different, the result 581 would be `file.txt.path1.path1` and `file.txt.path1.path2` (in addition to 582 `file.txt.path2`.) 583 - `delete` - keep the winner only and delete the loser, instead of renaming it. 584 If a winner cannot be determined (see `--conflict-resolve` for details on how 585 this could happen), `delete` is ignored and the default `num` is used instead 586 (i.e. both versions are kept and renamed, and neither is deleted.) `delete` is 587 inherently the most destructive option, so use it only with care. 588 589 For all of the above options, note that if a winner cannot be determined (see 590 `--conflict-resolve` for details on how this could happen), or if 591 `--conflict-resolve` is not in use, *both* files will be renamed. 592 593 ### --conflict-suffix STRING[,STRING] {#conflict-suffix} 594 595 `--conflict-suffix` controls the suffix that is appended when bisync renames a 596 [`--conflict-loser`](#conflict-loser) (default: `conflict`). 597 `--conflict-suffix` will accept either one string or two comma-separated 598 strings to assign different suffixes to Path1 vs. Path2. This may be helpful 599 later in identifying the source of the conflict. (For example, 600 `--conflict-suffix dropboxconflict,laptopconflict`) 601 602 With `--conflict-loser num`, a number is always appended to the suffix. With 603 `--conflict-loser pathname`, a number is appended only when one suffix is 604 specified (or when two identical suffixes are specified.) i.e. with 605 `--conflict-loser pathname`, all of the following would produce exactly the 606 same result: 607 608 ``` 609 --conflict-suffix path 610 --conflict-suffix path,path 611 --conflict-suffix path1,path2 612 ``` 613 614 Suffixes may be as short as 1 character. By default, the suffix is appended 615 after any other extensions (ex. `file.jpg.conflict1`), however, this can be 616 changed with the [`--suffix-keep-extension`](/docs/#suffix-keep-extension) flag 617 (i.e. to instead result in `file.conflict1.jpg`). 618 619 `--conflict-suffix` supports several *dynamic date variables* when enclosed in 620 curly braces as globs. This can be helpful to track the date and/or time that 621 each conflict was handled by bisync. For example: 622 623 ``` 624 --conflict-suffix {DateOnly}-conflict 625 // result: myfile.txt.2006-01-02-conflict1 626 ``` 627 628 All of the formats described [here](https://pkg.go.dev/time#pkg-constants) and 629 [here](https://pkg.go.dev/time#example-Time.Format) are supported, but take 630 care to ensure that your chosen format does not use any characters that are 631 illegal on your remotes (for example, macOS does not allow colons in 632 filenames, and slashes are also best avoided as they are often interpreted as 633 directory separators.) To address this particular issue, an additional 634 `{MacFriendlyTime}` (or just `{mac}`) option is supported, which results in 635 `2006-01-02 0304PM`. 636 637 Note that `--conflict-suffix` is entirely separate from rclone's main 638 [`--sufix`](/docs/#suffix-suffix) flag. This is intentional, as users may wish 639 to use both flags simultaneously, if also using 640 [`--backup-dir`](#backup-dir1-and-backup-dir2). 641 642 Finally, note that the default in bisync prior to `v1.66` was to rename 643 conflicts with `..path1` and `..path2` (with two periods, and `path` instead of 644 `conflict`.) Bisync now defaults to a single dot instead of a double dot, but 645 additional dots can be added by including them in the specified suffix string. 646 For example, for behavior equivalent to the previous default, use: 647 648 ``` 649 [--conflict-resolve none] --conflict-loser pathname --conflict-suffix .path 650 ``` 651 652 ### --check-sync 653 654 Enabled by default, the check-sync function checks that all of the same 655 files exist in both the Path1 and Path2 history listings. This _check-sync_ 656 integrity check is performed at the end of the sync run by default. 657 Any untrapped failing copy/deletes between the two paths might result 658 in differences between the two listings and in the untracked file content 659 differences between the two paths. A resync run would correct the error. 660 661 Note that the default-enabled integrity check locally executes a load of both 662 the final Path1 and Path2 listings, and thus adds to the run time of a sync. 663 Using `--check-sync=false` will disable it and may significantly reduce the 664 sync run times for very large numbers of files. 665 666 The check may be run manually with `--check-sync=only`. It runs only the 667 integrity check and terminates without actually synching. 668 669 Note that currently, `--check-sync` **only checks listing snapshots and NOT the 670 actual files on the remotes.** Note also that the listing snapshots will not 671 know about any changes that happened during or after the latest bisync run, as 672 those will be discovered on the next run. Therefore, while listings should 673 always match _each other_ at the end of a bisync run, it is _expected_ that 674 they will not match the underlying remotes, nor will the remotes match each 675 other, if there were changes during or after the run. This is normal, and any 676 differences will be detected and synced on the next run. 677 678 For a robust integrity check of the current state of the remotes (as opposed to just their listing snapshots), consider using [`check`](commands/rclone_check/) 679 (or [`cryptcheck`](/commands/rclone_cryptcheck/), if at least one path is a `crypt` remote) instead of `--check-sync`, 680 keeping in mind that differences are expected if files changed during or after your last bisync run. 681 682 For example, a possible sequence could look like this: 683 684 1. Normally scheduled bisync run: 685 686 ``` 687 rclone bisync Path1 Path2 -MPc --check-access --max-delete 10 --filters-file /path/to/filters.txt -v --no-cleanup --ignore-listing-checksum --disable ListR --checkers=16 --drive-pacer-min-sleep=10ms --create-empty-src-dirs --resilient 688 ``` 689 690 2. Periodic independent integrity check (perhaps scheduled nightly or weekly): 691 692 ``` 693 rclone check -MvPc Path1 Path2 --filter-from /path/to/filters.txt 694 ``` 695 696 3. If diffs are found, you have some choices to correct them. 697 If one side is more up-to-date and you want to make the other side match it, you could run: 698 699 ``` 700 rclone sync Path1 Path2 --filter-from /path/to/filters.txt --create-empty-src-dirs -MPc -v 701 ``` 702 (or switch Path1 and Path2 to make Path2 the source-of-truth) 703 704 Or, if neither side is totally up-to-date, you could run a `--resync` to bring them back into agreement 705 (but remember that this could cause deleted files to re-appear.) 706 707 *Note also that `rclone check` does not currently include empty directories, 708 so if you want to know if any empty directories are out of sync, 709 consider alternatively running the above `rclone sync` command with `--dry-run` added. 710 711 See also: [Concurrent modifications](#concurrent-modifications), [`--resilient`](#resilient) 712 713 ### --resilient 714 715 ***Caution: this is an experimental feature. Use at your own risk!*** 716 717 By default, most errors or interruptions will cause bisync to abort and 718 require [`--resync`](#resync) to recover. This is a safety feature, to prevent 719 bisync from running again until a user checks things out. However, in some 720 cases, bisync can go too far and enforce a lockout when one isn't actually 721 necessary, like for certain less-serious errors that might resolve themselves 722 on the next run. When `--resilient` is specified, bisync tries its best to 723 recover and self-correct, and only requires `--resync` as a last resort when a 724 human's involvement is absolutely necessary. The intended use case is for 725 running bisync as a background process (such as via scheduled [cron](#cron)). 726 727 When using `--resilient` mode, bisync will still report the error and abort, 728 however it will not lock out future runs -- allowing the possibility of 729 retrying at the next normally scheduled time, without requiring a `--resync` 730 first. Examples of such retryable errors include access test failures, missing 731 listing files, and filter change detections. These safety features will still 732 prevent the *current* run from proceeding -- the difference is that if 733 conditions have improved by the time of the *next* run, that next run will be 734 allowed to proceed. Certain more serious errors will still enforce a 735 `--resync` lockout, even in `--resilient` mode, to prevent data loss. 736 737 Behavior of `--resilient` may change in a future version. (See also: 738 [`--recover`](#recover), [`--max-lock`](#max-lock), [Graceful 739 Shutdown](#graceful-shutdown)) 740 741 ### --recover 742 743 If `--recover` is set, in the event of a sudden interruption or other 744 un-graceful shutdown, bisync will attempt to automatically recover on the next 745 run, instead of requiring `--resync`. Bisync is able to recover robustly by 746 keeping one "backup" listing at all times, representing the state of both paths 747 after the last known successful sync. Bisync can then compare the current state 748 with this snapshot to determine which changes it needs to retry. Changes that 749 were synced after this snapshot (during the run that was later interrupted) 750 will appear to bisync as if they are "new or changed on both sides", but in 751 most cases this is not a problem, as bisync will simply do its usual "equality 752 check" and learn that no action needs to be taken on these files, since they 753 are already identical on both sides. 754 755 In the rare event that a file is synced successfully during a run that later 756 aborts, and then that same file changes AGAIN before the next run, bisync will 757 think it is a sync conflict, and handle it accordingly. (From bisync's 758 perspective, the file has changed on both sides since the last trusted sync, 759 and the files on either side are not currently identical.) Therefore, 760 `--recover` carries with it a slightly increased chance of having conflicts -- 761 though in practice this is pretty rare, as the conditions required to cause it 762 are quite specific. This risk can be reduced by using bisync's ["Graceful 763 Shutdown"](#graceful-shutdown) mode (triggered by sending `SIGINT` or 764 `Ctrl+C`), when you have the choice, instead of forcing a sudden termination. 765 766 `--recover` and `--resilient` are similar, but distinct -- the main difference 767 is that `--resilient` is about _retrying_, while `--recover` is about 768 _recovering_. Most users will probably want both. `--resilient` allows retrying 769 when bisync has chosen to abort itself due to safety features such as failing 770 `--check-access` or detecting a filter change. `--resilient` does not cover 771 external interruptions such as a user shutting down their computer in the 772 middle of a sync -- that is what `--recover` is for. 773 774 ### --max-lock 775 776 Bisync uses [lock files](#lock-file) as a safety feature to prevent 777 interference from other bisync runs while it is running. Bisync normally 778 removes these lock files at the end of a run, but if bisync is abruptly 779 interrupted, these files will be left behind. By default, they will lock out 780 all future runs, until the user has a chance to manually check things out and 781 remove the lock. As an alternative, `--max-lock` can be used to make them 782 automatically expire after a certain period of time, so that future runs are 783 not locked out forever, and auto-recovery is possible. `--max-lock` can be any 784 duration `2m` or greater (or `0` to disable). If set, lock files older than 785 this will be considered "expired", and future runs will be allowed to disregard 786 them and proceed. (Note that the `--max-lock` duration must be set by the 787 process that left the lock file -- not the later one interpreting it.) 788 789 If set, bisync will also "renew" these lock files every `--max-lock minus one 790 minute` throughout a run, for extra safety. (For example, with `--max-lock 5m`, 791 bisync would renew the lock file (for another 5 minutes) every 4 minutes until 792 the run has completed.) In other words, it should not be possible for a lock 793 file to pass its expiration time while the process that created it is still 794 running -- and you can therefore be reasonably sure that any _expired_ lock 795 file you may find was left there by an interrupted run, not one that is still 796 running and just taking awhile. 797 798 If `--max-lock` is `0` or not set, the default is that lock files will never 799 expire, and will block future runs (of these same two bisync paths) 800 indefinitely. 801 802 For maximum resilience from disruptions, consider setting a relatively short 803 duration like `--max-lock 2m` along with [`--resilient`](#resilient) and 804 [`--recover`](#recover), and a relatively frequent [cron schedule](#cron). The 805 result will be a very robust "set-it-and-forget-it" bisync run that can 806 automatically bounce back from almost any interruption it might encounter, 807 without requiring the user to get involved and run a `--resync`. (See also: 808 [Graceful Shutdown](#graceful-shutdown) mode) 809 810 811 ### --backup-dir1 and --backup-dir2 812 813 As of `v1.66`, [`--backup-dir`](/docs/#backup-dir-dir) is supported in bisync. 814 Because `--backup-dir` must be a non-overlapping path on the same remote, 815 Bisync has introduced new `--backup-dir1` and `--backup-dir2` flags to support 816 separate backup-dirs for `Path1` and `Path2` (bisyncing between different 817 remotes with `--backup-dir` would not otherwise be possible.) `--backup-dir1` 818 and `--backup-dir2` can use different remotes from each other, but 819 `--backup-dir1` must use the same remote as `Path1`, and `--backup-dir2` must 820 use the same remote as `Path2`. Each backup directory must not overlap its 821 respective bisync Path without being excluded by a filter rule. 822 823 The standard `--backup-dir` will also work, if both paths use the same remote 824 (but note that deleted files from both paths would be mixed together in the 825 same dir). If either `--backup-dir1` and `--backup-dir2` are set, they will 826 override `--backup-dir`. 827 828 Example: 829 ``` 830 rclone bisync /Users/someuser/some/local/path/Bisync gdrive:Bisync --backup-dir1 /Users/someuser/some/local/path/BackupDir --backup-dir2 gdrive:BackupDir --suffix -2023-08-26 --suffix-keep-extension --check-access --max-delete 10 --filters-file /Users/someuser/some/local/path/bisync_filters.txt --no-cleanup --ignore-listing-checksum --checkers=16 --drive-pacer-min-sleep=10ms --create-empty-src-dirs --resilient -MvP --drive-skip-gdocs --fix-case 831 ``` 832 833 In this example, if the user deletes a file in 834 `/Users/someuser/some/local/path/Bisync`, bisync will propagate the delete to 835 the other side by moving the corresponding file from `gdrive:Bisync` to 836 `gdrive:BackupDir`. If the user deletes a file from `gdrive:Bisync`, bisync 837 moves it from `/Users/someuser/some/local/path/Bisync` to 838 `/Users/someuser/some/local/path/BackupDir`. 839 840 In the event of a [rename due to a sync conflict](#conflict-loser), the 841 rename is not considered a delete, unless a previous conflict with the same 842 name already exists and would get overwritten. 843 844 See also: [`--suffix`](/docs/#suffix-suffix), 845 [`--suffix-keep-extension`](/docs/#suffix-keep-extension) 846 847 ## Operation 848 849 ### Runtime flow details 850 851 bisync retains the listings of the `Path1` and `Path2` filesystems 852 from the prior run. 853 On each successive run it will: 854 855 - list files on `path1` and `path2`, and check for changes on each side. 856 Changes include `New`, `Newer`, `Older`, and `Deleted` files. 857 - Propagate changes on `path1` to `path2`, and vice-versa. 858 859 ### Safety measures 860 861 - Lock file prevents multiple simultaneous runs when taking a while. 862 This can be particularly useful if bisync is run by cron scheduler. 863 - Handle change conflicts non-destructively by creating 864 `.conflict1`, `.conflict2`, etc. file versions, according to 865 [`--conflict-resolve`](#conflict-resolve), [`--conflict-loser`](#conflict-loser), and [`--conflict-suffix`](#conflict-suffix) settings. 866 - File system access health check using `RCLONE_TEST` files 867 (see the `--check-access` flag). 868 - Abort on excessive deletes - protects against a failed listing 869 being interpreted as all the files were deleted. 870 See the `--max-delete` and `--force` flags. 871 - If something evil happens, bisync goes into a safe state to block 872 damage by later runs. (See [Error Handling](#error-handling)) 873 874 ### Normal sync checks 875 876 Type | Description | Result | Implementation 877 --------------|-----------------------------------------------|--------------------------|----------------------------- 878 Path2 new | File is new on Path2, does not exist on Path1 | Path2 version survives | `rclone copy` Path2 to Path1 879 Path2 newer | File is newer on Path2, unchanged on Path1 | Path2 version survives | `rclone copy` Path2 to Path1 880 Path2 deleted | File is deleted on Path2, unchanged on Path1 | File is deleted | `rclone delete` Path1 881 Path1 new | File is new on Path1, does not exist on Path2 | Path1 version survives | `rclone copy` Path1 to Path2 882 Path1 newer | File is newer on Path1, unchanged on Path2 | Path1 version survives | `rclone copy` Path1 to Path2 883 Path1 older | File is older on Path1, unchanged on Path2 | _Path1 version survives_ | `rclone copy` Path1 to Path2 884 Path2 older | File is older on Path2, unchanged on Path1 | _Path2 version survives_ | `rclone copy` Path2 to Path1 885 Path1 deleted | File no longer exists on Path1 | File is deleted | `rclone delete` Path2 886 887 ### Unusual sync checks 888 889 Type | Description | Result | Implementation 890 --------------------------------|---------------------------------------|------------------------------------|----------------------- 891 Path1 new/changed AND Path2 new/changed AND Path1 == Path2 | File is new/changed on Path1 AND new/changed on Path2 AND Path1 version is currently identical to Path2 | No change | None 892 Path1 new AND Path2 new | File is new on Path1 AND new on Path2 (and Path1 version is NOT identical to Path2) | Conflicts handled according to [`--conflict-resolve`](#conflict-resolve) & [`--conflict-loser`](#conflict-loser) settings | default: `rclone copy` renamed `Path2.conflict2` file to Path1, `rclone copy` renamed `Path1.conflict1` file to Path2 893 Path2 newer AND Path1 changed | File is newer on Path2 AND also changed (newer/older/size) on Path1 (and Path1 version is NOT identical to Path2) | Conflicts handled according to [`--conflict-resolve`](#conflict-resolve) & [`--conflict-loser`](#conflict-loser) settings | default: `rclone copy` renamed `Path2.conflict2` file to Path1, `rclone copy` renamed `Path1.conflict1` file to Path2 894 Path2 newer AND Path1 deleted | File is newer on Path2 AND also deleted on Path1 | Path2 version survives | `rclone copy` Path2 to Path1 895 Path2 deleted AND Path1 changed | File is deleted on Path2 AND changed (newer/older/size) on Path1 | Path1 version survives |`rclone copy` Path1 to Path2 896 Path1 deleted AND Path2 changed | File is deleted on Path1 AND changed (newer/older/size) on Path2 | Path2 version survives | `rclone copy` Path2 to Path1 897 898 As of `rclone v1.64`, bisync is now better at detecting *false positive* sync conflicts, 899 which would previously have resulted in unnecessary renames and duplicates. 900 Now, when bisync comes to a file that it wants to rename (because it is new/changed on both sides), 901 it first checks whether the Path1 and Path2 versions are currently *identical* 902 (using the same underlying function as [`check`](commands/rclone_check/).) 903 If bisync concludes that the files are identical, it will skip them and move on. 904 Otherwise, it will create renamed duplicates, as before. 905 This behavior also [improves the experience of renaming directories](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=Renamed%20directories), 906 as a `--resync` is no longer required, so long as the same change has been made on both sides. 907 908 ### All files changed check {#all-files-changed} 909 910 If _all_ prior existing files on either of the filesystems have changed 911 (e.g. timestamps have changed due to changing the system's timezone) 912 then bisync will abort without making any changes. 913 Any new files are not considered for this check. You could use `--force` 914 to force the sync (whichever side has the changed timestamp files wins). 915 Alternately, a `--resync` may be used (Path1 versions will be pushed 916 to Path2). Consider the situation carefully and perhaps use `--dry-run` 917 before you commit to the changes. 918 919 ### Modification times 920 921 By default, bisync compares files by modification time and size. 922 If you or your application should change the content of a file 923 without changing the modification time and size, then bisync will _not_ 924 notice the change, and thus will not copy it to the other side. 925 As an alternative, consider comparing by checksum (if your remotes support it). 926 See [`--compare`](#compare) for details. 927 928 ### Error handling {#error-handling} 929 930 Certain bisync critical errors, such as file copy/move failing, will result in 931 a bisync lockout of following runs. The lockout is asserted because the sync 932 status and history of the Path1 and Path2 filesystems cannot be trusted, 933 so it is safer to block any further changes until someone checks things out. 934 The recovery is to do a `--resync` again. 935 936 It is recommended to use `--resync --dry-run --verbose` initially and 937 _carefully_ review what changes will be made before running the `--resync` 938 without `--dry-run`. 939 940 Most of these events come up due to an error status from an internal call. 941 On such a critical error the `{...}.path1.lst` and `{...}.path2.lst` 942 listing files are renamed to extension `.lst-err`, which blocks any future 943 bisync runs (since the normal `.lst` files are not found). 944 Bisync keeps them under `bisync` subdirectory of the rclone cache directory, 945 typically at `${HOME}/.cache/rclone/bisync/` on Linux. 946 947 Some errors are considered temporary and re-running the bisync is not blocked. 948 The _critical return_ blocks further bisync runs. 949 950 See also: [`--resilient`](#resilient), [`--recover`](#recover), 951 [`--max-lock`](#max-lock), [Graceful Shutdown](#graceful-shutdown) 952 953 ### Lock file 954 955 When bisync is running, a lock file is created in the bisync working directory, 956 typically at `~/.cache/rclone/bisync/PATH1..PATH2.lck` on Linux. 957 If bisync should crash or hang, the lock file will remain in place and block 958 any further runs of bisync _for the same paths_. 959 Delete the lock file as part of debugging the situation. 960 The lock file effectively blocks follow-on (e.g., scheduled by _cron_) runs 961 when the prior invocation is taking a long time. 962 The lock file contains _PID_ of the blocking process, which may help in debug. 963 Lock files can be set to automatically expire after a certain amount of time, 964 using the [`--max-lock`](#max-lock) flag. 965 966 **Note** 967 that while concurrent bisync runs are allowed, _be very cautious_ 968 that there is no overlap in the trees being synched between concurrent runs, 969 lest there be replicated files, deleted files and general mayhem. 970 971 ### Return codes 972 973 `rclone bisync` returns the following codes to calling program: 974 - `0` on a successful run, 975 - `1` for a non-critical failing run (a rerun may be successful), 976 - `2` for a critically aborted run (requires a `--resync` to recover). 977 978 ### Graceful Shutdown 979 980 Bisync has a "Graceful Shutdown" mode which is activated by sending `SIGINT` or 981 pressing `Ctrl+C` during a run. Once triggered, bisync will use best efforts to 982 exit cleanly before the timer runs out. If bisync is in the middle of 983 transferring files, it will attempt to cleanly empty its queue by finishing 984 what it has started but not taking more. If it cannot do so within 30 seconds, 985 it will cancel the in-progress transfers at that point and then give itself a 986 maximum of 60 seconds to wrap up, save its state for next time, and exit. With 987 the `-vP` flags you will see constant status updates and a final confirmation 988 of whether or not the graceful shutdown was successful. 989 990 At any point during the "Graceful Shutdown" sequence, a second `SIGINT` or 991 `Ctrl+C` will trigger an immediate, un-graceful exit, which will leave things 992 in a messier state. Usually a robust recovery will still be possible if using 993 [`--recover`](#recover) mode, otherwise you will need to do a `--resync`. 994 995 If you plan to use Graceful Shutdown mode, it is recommended to use 996 [`--resilient`](#resilient) and [`--recover`](#recover), and it is important to 997 NOT use [`--inplace`](/docs/#inplace), otherwise you risk leaving 998 partially-written files on one side, which may be confused for real files on 999 the next run. Note also that in the event of an abrupt interruption, a [lock 1000 file](#lock-file) will be left behind to block concurrent runs. You will need 1001 to delete it before you can proceed with the next run (or wait for it to 1002 expire on its own, if using `--max-lock`.) 1003 1004 ## Limitations 1005 1006 ### Supported backends 1007 1008 Bisync is considered _BETA_ and has been tested with the following backends: 1009 - Local filesystem 1010 - Google Drive 1011 - Dropbox 1012 - OneDrive 1013 - S3 1014 - SFTP 1015 - Yandex Disk 1016 - Crypt 1017 1018 It has not been fully tested with other services yet. 1019 If it works, or sorta works, please let us know and we'll update the list. 1020 Run the test suite to check for proper operation as described below. 1021 1022 The first release of `rclone bisync` required both underlying backends to support 1023 modification times, and refused to run otherwise. 1024 This limitation has been lifted as of `v1.66`, as bisync now supports comparing 1025 checksum and/or size instead of (or in addition to) modtime. 1026 See [`--compare`](#compare) for details. 1027 1028 ### Concurrent modifications 1029 1030 When using **Local, FTP or SFTP** remotes with [`--inplace`](/docs/#inplace), rclone does not create _temporary_ 1031 files at the destination when copying, and thus if the connection is lost 1032 the created file may be corrupt, which will likely propagate back to the 1033 original path on the next sync, resulting in data loss. 1034 It is therefore recommended to _omit_ `--inplace`. 1035 1036 Files that **change during** a bisync run may result in data loss. 1037 Prior to `rclone v1.66`, this was commonly seen in highly dynamic environments, where the filesystem 1038 was getting hammered by running processes during the sync. 1039 As of `rclone v1.66`, bisync was redesigned to use a "snapshot" model, 1040 greatly reducing the risks from changes during a sync. 1041 Changes that are not detected during the current sync will now be detected during the following sync, 1042 and will no longer cause the entire run to throw a critical error. 1043 There is additionally a mechanism to mark files as needing to be internally rechecked next time, for added safety. 1044 It should therefore no longer be necessary to sync only at quiet times -- 1045 however, note that an error can still occur if a file happens to change at the exact moment it's 1046 being read/written by bisync (same as would happen in `rclone sync`.) 1047 (See also: [`--ignore-checksum`](https://rclone.org/docs/#ignore-checksum), 1048 [`--local-no-check-updated`](https://rclone.org/local/#local-no-check-updated)) 1049 1050 ### Empty directories 1051 1052 By default, new/deleted empty directories on one path are _not_ propagated to the other side. 1053 This is because bisync (and rclone) natively works on files, not directories. 1054 However, this can be changed with the `--create-empty-src-dirs` flag, which works in 1055 much the same way as in [`sync`](/commands/rclone_sync/) and [`copy`](/commands/rclone_copy/). 1056 When used, empty directories created or deleted on one side will also be created or deleted on the other side. 1057 The following should be noted: 1058 * `--create-empty-src-dirs` is not compatible with `--remove-empty-dirs`. Use only one or the other (or neither). 1059 * It is not recommended to switch back and forth between `--create-empty-src-dirs` 1060 and the default (no `--create-empty-src-dirs`) without running `--resync`. 1061 This is because it may appear as though all directories (not just the empty ones) were created/deleted, 1062 when actually you've just toggled between making them visible/invisible to bisync. 1063 It looks scarier than it is, but it's still probably best to stick to one or the other, 1064 and use `--resync` when you need to switch. 1065 1066 ### Renamed directories 1067 1068 By default, renaming a folder on the Path1 side results in deleting all files on 1069 the Path2 side and then copying all files again from Path1 to Path2. 1070 Bisync sees this as all files in the old directory name as deleted and all 1071 files in the new directory name as new. 1072 1073 A recommended solution is to use [`--track-renames`](/docs/#track-renames), 1074 which is now supported in bisync as of `rclone v1.66`. 1075 Note that `--track-renames` is not available during `--resync`, 1076 as `--resync` does not delete anything (`--track-renames` only supports `sync`, not `copy`.) 1077 1078 Otherwise, the most effective and efficient method of renaming a directory 1079 is to rename it to the same name on both sides. (As of `rclone v1.64`, 1080 a `--resync` is no longer required after doing so, as bisync will automatically 1081 detect that Path1 and Path2 are in agreement.) 1082 1083 ### `--fast-list` used by default 1084 1085 Unlike most other rclone commands, bisync uses [`--fast-list`](/docs/#fast-list) by default, 1086 for backends that support it. In many cases this is desirable, however, 1087 there are some scenarios in which bisync could be faster *without* `--fast-list`, 1088 and there is also a [known issue concerning Google Drive users with many empty directories](https://github.com/rclone/rclone/commit/cbf3d4356135814921382dd3285d859d15d0aa77). 1089 For now, the recommended way to avoid using `--fast-list` is to add `--disable ListR` 1090 to all bisync commands. The default behavior may change in a future version. 1091 1092 ### Case (and unicode) sensitivity {#case-sensitivity} 1093 1094 As of `v1.66`, case and unicode form differences no longer cause critical errors, 1095 and normalization (when comparing between filesystems) is handled according to the same flags and defaults as `rclone sync`. 1096 See the following options (all of which are supported by bisync) to control this behavior more granularly: 1097 - [`--fix-case`](/docs/#fix-case) 1098 - [`--ignore-case-sync`](/docs/#ignore-case-sync) 1099 - [`--no-unicode-normalization`](/docs/#no-unicode-normalization) 1100 - [`--local-unicode-normalization`](/local/#local-unicode-normalization) and 1101 [`--local-case-sensitive`](/local/#local-case-sensitive) (caution: these are normally not what you want.) 1102 1103 Note that in the (probably rare) event that `--fix-case` is used AND a file is new/changed on both sides 1104 AND the checksums match AND the filename case does not match, the Path1 filename is considered the winner, 1105 for the purposes of `--fix-case` (Path2 will be renamed to match it). 1106 1107 ## Windows support {#windows} 1108 1109 Bisync has been tested on Windows 8.1, Windows 10 Pro 64-bit and on Windows 1110 GitHub runners. 1111 1112 Drive letters are allowed, including drive letters mapped to network drives 1113 (`rclone bisync J:\localsync GDrive:`). 1114 If a drive letter is omitted, the shell current drive is the default. 1115 Drive letters are a single character follows by `:`, so cloud names 1116 must be more than one character long. 1117 1118 Absolute paths (with or without a drive letter), and relative paths 1119 (with or without a drive letter) are supported. 1120 1121 Working directory is created at `C:\Users\MyLogin\AppData\Local\rclone\bisync`. 1122 1123 Note that bisync output may show a mix of forward `/` and back `\` slashes. 1124 1125 Be careful of case independent directory and file naming on Windows 1126 vs. case dependent Linux 1127 1128 ## Filtering {#filtering} 1129 1130 See [filtering documentation](/filtering/) 1131 for how filter rules are written and interpreted. 1132 1133 Bisync's [`--filters-file`](#filters-file) flag slightly extends the rclone's 1134 [--filter-from](/filtering/#filter-from-read-filtering-patterns-from-a-file) 1135 filtering mechanism. 1136 For a given bisync run you may provide _only one_ `--filters-file`. 1137 The `--include*`, `--exclude*`, and `--filter` flags are also supported. 1138 1139 ### How to filter directories 1140 1141 Filtering portions of the directory tree is a critical feature for synching. 1142 1143 Examples of directory trees (always beneath the Path1/Path2 root level) 1144 you may want to exclude from your sync: 1145 - Directory trees containing only software build intermediate files. 1146 - Directory trees containing application temporary files and data 1147 such as the Windows `C:\Users\MyLogin\AppData\` tree. 1148 - Directory trees containing files that are large, less important, 1149 or are getting thrashed continuously by ongoing processes. 1150 1151 On the other hand, there may be only select directories that you 1152 actually want to sync, and exclude all others. See the 1153 [Example include-style filters for Windows user directories](#include-filters) 1154 below. 1155 1156 ### Filters file writing guidelines 1157 1158 1. Begin with excluding directory trees: 1159 - e.g. `- /AppData/` 1160 - `**` on the end is not necessary. Once a given directory level 1161 is excluded then everything beneath it won't be looked at by rclone. 1162 - Exclude such directories that are unneeded, are big, dynamically thrashed, 1163 or where there may be access permission issues. 1164 - Excluding such dirs first will make rclone operations (much) faster. 1165 - Specific files may also be excluded, as with the Dropbox exclusions 1166 example below. 1167 2. Decide if it's easier (or cleaner) to: 1168 - Include select directories and therefore _exclude everything else_ -- or -- 1169 - Exclude select directories and therefore _include everything else_ 1170 3. Include select directories: 1171 - Add lines like: `+ /Documents/PersonalFiles/**` to select which 1172 directories to include in the sync. 1173 - `**` on the end specifies to include the full depth of the specified tree. 1174 - With Include-style filters, files at the Path1/Path2 root are not included. 1175 They may be included with `+ /*`. 1176 - Place RCLONE_TEST files within these included directory trees. 1177 They will only be looked for in these directory trees. 1178 - Finish by excluding everything else by adding `- **` at the end 1179 of the filters file. 1180 - Disregard step 4. 1181 4. Exclude select directories: 1182 - Add more lines like in step 1. 1183 For example: `-/Desktop/tempfiles/`, or `- /testdir/`. 1184 Again, a `**` on the end is not necessary. 1185 - Do _not_ add a `- **` in the file. Without this line, everything 1186 will be included that has not been explicitly excluded. 1187 - Disregard step 3. 1188 1189 A few rules for the syntax of a filter file expanding on 1190 [filtering documentation](/filtering/): 1191 1192 - Lines may start with spaces and tabs - rclone strips leading whitespace. 1193 - If the first non-whitespace character is a `#` then the line is a comment 1194 and will be ignored. 1195 - Blank lines are ignored. 1196 - The first non-whitespace character on a filter line must be a `+` or `-`. 1197 - Exactly 1 space is allowed between the `+/-` and the path term. 1198 - Only forward slashes (`/`) are used in path terms, even on Windows. 1199 - The rest of the line is taken as the path term. 1200 Trailing whitespace is taken literally, and probably is an error. 1201 1202 ### Example include-style filters for Windows user directories {#include-filters} 1203 1204 This Windows _include-style_ example is based on the sync root (Path1) 1205 set to `C:\Users\MyLogin`. The strategy is to select specific directories 1206 to be synched with a network drive (Path2). 1207 1208 - `- /AppData/` excludes an entire tree of Windows stored stuff 1209 that need not be synched. 1210 In my case, AppData has >11 GB of stuff I don't care about, and there are 1211 some subdirectories beneath AppData that are not accessible to my 1212 user login, resulting in bisync critical aborts. 1213 - Windows creates cache files starting with both upper and 1214 lowercase `NTUSER` at `C:\Users\MyLogin`. These files may be dynamic, 1215 locked, and are generally _don't care_. 1216 - There are just a few directories with _my_ data that I do want synched, 1217 in the form of `+ /<path>`. By selecting only the directory trees I 1218 want to avoid the dozen plus directories that various apps make 1219 at `C:\Users\MyLogin\Documents`. 1220 - Include files in the root of the sync point, `C:\Users\MyLogin`, 1221 by adding the `+ /*` line. 1222 - This is an Include-style filters file, therefore it ends with `- **` 1223 which excludes everything not explicitly included. 1224 1225 ``` 1226 - /AppData/ 1227 - NTUSER* 1228 - ntuser* 1229 + /Documents/Family/** 1230 + /Documents/Sketchup/** 1231 + /Documents/Microcapture_Photo/** 1232 + /Documents/Microcapture_Video/** 1233 + /Desktop/** 1234 + /Pictures/** 1235 + /* 1236 - ** 1237 ``` 1238 1239 Note also that Windows implements several "library" links such as 1240 `C:\Users\MyLogin\My Documents\My Music` pointing to `C:\Users\MyLogin\Music`. 1241 rclone sees these as links, so you must add `--links` to the 1242 bisync command line if you which to follow these links. I find that I get 1243 permission errors in trying to follow the links, so I don't include the 1244 rclone `--links` flag, but then you get lots of `Can't follow symlink…` 1245 noise from rclone about not following the links. This noise can be 1246 quashed by adding `--quiet` to the bisync command line. 1247 1248 ## Example exclude-style filters files for use with Dropbox {#exclude-filters} 1249 1250 - Dropbox disallows synching the listed temporary and configuration/data files. 1251 The `- <filename>` filters exclude these files where ever they may occur 1252 in the sync tree. Consider adding similar exclusions for file types 1253 you don't need to sync, such as core dump and software build files. 1254 - bisync testing creates `/testdir/` at the top level of the sync tree, 1255 and usually deletes the tree after the test. If a normal sync should run 1256 while the `/testdir/` tree exists the `--check-access` phase may fail 1257 due to unbalanced RCLONE_TEST files. 1258 The `- /testdir/` filter blocks this tree from being synched. 1259 You don't need this exclusion if you are not doing bisync development testing. 1260 - Everything else beneath the Path1/Path2 root will be synched. 1261 - RCLONE_TEST files may be placed anywhere within the tree, including the root. 1262 1263 ### Example filters file for Dropbox {#example-filters-file} 1264 1265 ``` 1266 # Filter file for use with bisync 1267 # See https://rclone.org/filtering/ for filtering rules 1268 # NOTICE: If you make changes to this file you MUST do a --resync run. 1269 # Run with --dry-run to see what changes will be made. 1270 1271 # Dropbox won't sync some files so filter them away here. 1272 # See https://help.dropbox.com/installs-integrations/sync-uploads/files-not-syncing 1273 - .dropbox.attr 1274 - ~*.tmp 1275 - ~$* 1276 - .~* 1277 - desktop.ini 1278 - .dropbox 1279 1280 # Used for bisync testing, so excluded from normal runs 1281 - /testdir/ 1282 1283 # Other example filters 1284 #- /TiBU/ 1285 #- /Photos/ 1286 ``` 1287 1288 ### How --check-access handles filters 1289 1290 At the start of a bisync run, listings are gathered for Path1 and Path2 1291 while using the user's `--filters-file`. During the check access phase, 1292 bisync scans these listings for `RCLONE_TEST` files. 1293 Any `RCLONE_TEST` files hidden by the `--filters-file` are _not_ in the 1294 listings and thus not checked during the check access phase. 1295 1296 ## Troubleshooting {#troubleshooting} 1297 1298 ### Reading bisync logs 1299 1300 Here are two normal runs. The first one has a newer file on the remote. 1301 The second has no deltas between local and remote. 1302 1303 ``` 1304 2021/05/16 00:24:38 INFO : Synching Path1 "/path/to/local/tree/" with Path2 "dropbox:/" 1305 2021/05/16 00:24:38 INFO : Path1 checking for diffs 1306 2021/05/16 00:24:38 INFO : - Path1 File is new - file.txt 1307 2021/05/16 00:24:38 INFO : Path1: 1 changes: 1 new, 0 newer, 0 older, 0 deleted 1308 2021/05/16 00:24:38 INFO : Path2 checking for diffs 1309 2021/05/16 00:24:38 INFO : Applying changes 1310 2021/05/16 00:24:38 INFO : - Path1 Queue copy to Path2 - dropbox:/file.txt 1311 2021/05/16 00:24:38 INFO : - Path1 Do queued copies to - Path2 1312 2021/05/16 00:24:38 INFO : Updating listings 1313 2021/05/16 00:24:38 INFO : Validating listings for Path1 "/path/to/local/tree/" vs Path2 "dropbox:/" 1314 2021/05/16 00:24:38 INFO : Bisync successful 1315 1316 2021/05/16 00:36:52 INFO : Synching Path1 "/path/to/local/tree/" with Path2 "dropbox:/" 1317 2021/05/16 00:36:52 INFO : Path1 checking for diffs 1318 2021/05/16 00:36:52 INFO : Path2 checking for diffs 1319 2021/05/16 00:36:52 INFO : No changes found 1320 2021/05/16 00:36:52 INFO : Updating listings 1321 2021/05/16 00:36:52 INFO : Validating listings for Path1 "/path/to/local/tree/" vs Path2 "dropbox:/" 1322 2021/05/16 00:36:52 INFO : Bisync successful 1323 ``` 1324 1325 ### Dry run oddity 1326 1327 The `--dry-run` messages may indicate that it would try to delete some files. 1328 For example, if a file is new on Path2 and does not exist on Path1 then 1329 it would normally be copied to Path1, but with `--dry-run` enabled those 1330 copies don't happen, which leads to the attempted delete on Path2, 1331 blocked again by --dry-run: `... Not deleting as --dry-run`. 1332 1333 This whole confusing situation is an artifact of the `--dry-run` flag. 1334 Scrutinize the proposed deletes carefully, and if the files would have been 1335 copied to Path1 then the threatened deletes on Path2 may be disregarded. 1336 1337 ### Retries 1338 1339 Rclone has built-in retries. If you run with `--verbose` you'll see 1340 error and retry messages such as shown below. This is usually not a bug. 1341 If at the end of the run, you see `Bisync successful` and not 1342 `Bisync critical error` or `Bisync aborted` then the run was successful, 1343 and you can ignore the error messages. 1344 1345 The following run shows an intermittent fail. Lines _5_ and _6- are 1346 low-level messages. Line _6_ is a bubbled-up _warning_ message, conveying 1347 the error. Rclone normally retries failing commands, so there may be 1348 numerous such messages in the log. 1349 1350 Since there are no final error/warning messages on line _7_, rclone has 1351 recovered from failure after a retry, and the overall sync was successful. 1352 1353 ``` 1354 1: 2021/05/14 00:44:12 INFO : Synching Path1 "/path/to/local/tree" with Path2 "dropbox:" 1355 2: 2021/05/14 00:44:12 INFO : Path1 checking for diffs 1356 3: 2021/05/14 00:44:12 INFO : Path2 checking for diffs 1357 4: 2021/05/14 00:44:12 INFO : Path2: 113 changes: 22 new, 0 newer, 0 older, 91 deleted 1358 5: 2021/05/14 00:44:12 ERROR : /path/to/local/tree/objects/af: error listing: unexpected end of JSON input 1359 6: 2021/05/14 00:44:12 NOTICE: WARNING listing try 1 failed. - dropbox: 1360 7: 2021/05/14 00:44:12 INFO : Bisync successful 1361 ``` 1362 1363 This log shows a _Critical failure_ which requires a `--resync` to recover from. 1364 See the [Runtime Error Handling](#error-handling) section. 1365 1366 ``` 1367 2021/05/12 00:49:40 INFO : Google drive root '': Waiting for checks to finish 1368 2021/05/12 00:49:40 INFO : Google drive root '': Waiting for transfers to finish 1369 2021/05/12 00:49:40 INFO : Google drive root '': not deleting files as there were IO errors 1370 2021/05/12 00:49:40 ERROR : Attempt 3/3 failed with 3 errors and: not deleting files as there were IO errors 1371 2021/05/12 00:49:40 ERROR : Failed to sync: not deleting files as there were IO errors 1372 2021/05/12 00:49:40 NOTICE: WARNING rclone sync try 3 failed. - /path/to/local/tree/ 1373 2021/05/12 00:49:40 ERROR : Bisync aborted. Must run --resync to recover. 1374 ``` 1375 1376 ### Denied downloads of "infected" or "abusive" files 1377 1378 Google Drive has a filter for certain file types (`.exe`, `.apk`, et cetera) 1379 that by default cannot be copied from Google Drive to the local filesystem. 1380 If you are having problems, run with `--verbose` to see specifically which 1381 files are generating complaints. If the error is 1382 `This file has been identified as malware or spam and cannot be downloaded`, 1383 consider using the flag 1384 [--drive-acknowledge-abuse](/drive/#drive-acknowledge-abuse). 1385 1386 ### Google Docs (and other files of unknown size) {#gdocs} 1387 1388 As of `v1.66`, [Google Docs](/drive/#import-export-of-google-documents) 1389 (including Google Sheets, Slides, etc.) are now supported in bisync, subject to 1390 the same options, defaults, and limitations as in `rclone sync`. When bisyncing 1391 drive with non-drive backends, the drive -> non-drive direction is controlled 1392 by [`--drive-export-formats`](/drive/#drive-export-formats) (default 1393 `"docx,xlsx,pptx,svg"`) and the non-drive -> drive direction is controlled by 1394 [`--drive-import-formats`](/drive/#drive-import-formats) (default none.) 1395 1396 For example, with the default export/import formats, a Google Sheet on the 1397 drive side will be synced to an `.xlsx` file on the non-drive side. In the 1398 reverse direction, `.xlsx` files with filenames that match an existing Google 1399 Sheet will be synced to that Google Sheet, while `.xlsx` files that do NOT 1400 match an existing Google Sheet will be copied to drive as normal `.xlsx` files 1401 (without conversion to Sheets, although the Google Drive web browser UI may 1402 still give you the option to open it as one.) 1403 1404 If `--drive-import-formats` is set (it's not, by default), then all of the 1405 specified formats will be converted to Google Docs, if there is no existing 1406 Google Doc with a matching name. Caution: such conversion can be quite lossy, 1407 and in most cases it's probably not what you want! 1408 1409 To bisync Google Docs as URL shortcut links (in a manner similar to "Drive for 1410 Desktop"), use: `--drive-export-formats url` (or 1411 [alternatives](https://rclone.org/drive/#exportformats:~:text=available%20Google%20Documents.-,Extension,macOS,-Standard%20options).) 1412 1413 Note that these link files cannot be edited on the non-drive side -- you will 1414 get errors if you try to sync an edited link file back to drive. They CAN be 1415 deleted (it will result in deleting the corresponding Google Doc.) If you 1416 create a `.url` file on the non-drive side that does not match an existing 1417 Google Doc, bisyncing it will just result in copying the literal `.url` file 1418 over to drive (no Google Doc will be created.) So, as a general rule of thumb, 1419 think of them as read-only placeholders on the non-drive side, and make all 1420 your changes on the drive side. 1421 1422 Likewise, even with other export-formats, it is best to only move/rename Google 1423 Docs on the drive side. This is because otherwise, bisync will interpret this 1424 as a file deleted and another created, and accordingly, it will delete the 1425 Google Doc and create a new file at the new path. (Whether or not that new file 1426 is a Google Doc depends on `--drive-import-formats`.) 1427 1428 Lastly, take note that all Google Docs on the drive side have a size of `-1` 1429 and no checksum. Therefore, they cannot be reliably synced with the 1430 `--checksum` or `--size-only` flags. (To be exact: they will still get 1431 created/deleted, and bisync's delta engine will notice changes and queue them 1432 for syncing, but the underlying sync function will consider them identical and 1433 skip them.) To work around this, use the default (modtime and size) instead of 1434 `--checksum` or `--size-only`. 1435 1436 To ignore Google Docs entirely, use 1437 [`--drive-skip-gdocs`](/drive/#drive-skip-gdocs). 1438 1439 ## Usage examples 1440 1441 ### Cron {#cron} 1442 1443 Rclone does not yet have a built-in capability to monitor the local file 1444 system for changes and must be blindly run periodically. 1445 On Windows this can be done using a _Task Scheduler_, 1446 on Linux you can use _Cron_ which is described below. 1447 1448 The 1st example runs a sync every 5 minutes between a local directory 1449 and an OwnCloud server, with output logged to a runlog file: 1450 1451 ``` 1452 # Minute (0-59) 1453 # Hour (0-23) 1454 # Day of Month (1-31) 1455 # Month (1-12 or Jan-Dec) 1456 # Day of Week (0-6 or Sun-Sat) 1457 # Command 1458 */5 * * * * /path/to/rclone bisync /local/files MyCloud: --check-access --filters-file /path/to/bysync-filters.txt --log-file /path/to//bisync.log 1459 ``` 1460 1461 See [crontab syntax](https://www.man7.org/linux/man-pages/man1/crontab.1p.html#INPUT_FILES) 1462 for the details of crontab time interval expressions. 1463 1464 If you run `rclone bisync` as a cron job, redirect stdout/stderr to a file. 1465 The 2nd example runs a sync to Dropbox every hour and logs all stdout (via the `>>`) 1466 and stderr (via `2>&1`) to a log file. 1467 1468 ``` 1469 0 * * * * /path/to/rclone bisync /path/to/local/dropbox Dropbox: --check-access --filters-file /home/user/filters.txt >> /path/to/logs/dropbox-run.log 2>&1 1470 ``` 1471 1472 ### Sharing an encrypted folder tree between hosts 1473 1474 bisync can keep a local folder in sync with a cloud service, 1475 but what if you have some highly sensitive files to be synched? 1476 1477 Usage of a cloud service is for exchanging both routine and sensitive 1478 personal files between one's home network, one's personal notebook when on the 1479 road, and with one's work computer. The routine data is not sensitive. 1480 For the sensitive data, configure an rclone [crypt remote](/crypt/) to point to 1481 a subdirectory within the local disk tree that is bisync'd to Dropbox, 1482 and then set up an bisync for this local crypt directory to a directory 1483 outside of the main sync tree. 1484 1485 ### Linux server setup 1486 1487 - `/path/to/DBoxroot` is the root of my local sync tree. 1488 There are numerous subdirectories. 1489 - `/path/to/DBoxroot/crypt` is the root subdirectory for files 1490 that are encrypted. This local directory target is setup as an 1491 rclone crypt remote named `Dropcrypt:`. 1492 See [rclone.conf](#rclone-conf-snippet) snippet below. 1493 - `/path/to/my/unencrypted/files` is the root of my sensitive 1494 files - not encrypted, not within the tree synched to Dropbox. 1495 - To sync my local unencrypted files with the encrypted Dropbox versions 1496 I manually run `bisync /path/to/my/unencrypted/files DropCrypt:`. 1497 This step could be bundled into a script to run before and after 1498 the full Dropbox tree sync in the last step, 1499 thus actively keeping the sensitive files in sync. 1500 - `bisync /path/to/DBoxroot Dropbox:` runs periodically via cron, 1501 keeping my full local sync tree in sync with Dropbox. 1502 1503 ### Windows notebook setup 1504 1505 - The Dropbox client runs keeping the local tree `C:\Users\MyLogin\Dropbox` 1506 always in sync with Dropbox. I could have used `rclone bisync` instead. 1507 - A separate directory tree at `C:\Users\MyLogin\Documents\DropLocal` 1508 hosts the tree of unencrypted files/folders. 1509 - To sync my local unencrypted files with the encrypted 1510 Dropbox versions I manually run the following command: 1511 `rclone bisync C:\Users\MyLogin\Documents\DropLocal Dropcrypt:`. 1512 - The Dropbox client then syncs the changes with Dropbox. 1513 1514 ### rclone.conf snippet {#rclone-conf-snippet} 1515 1516 ``` 1517 [Dropbox] 1518 type = dropbox 1519 ... 1520 1521 [Dropcrypt] 1522 type = crypt 1523 remote = /path/to/DBoxroot/crypt # on the Linux server 1524 remote = C:\Users\MyLogin\Dropbox\crypt # on the Windows notebook 1525 filename_encryption = standard 1526 directory_name_encryption = true 1527 password = ... 1528 ... 1529 ``` 1530 1531 ## Testing {#testing} 1532 1533 You should read this section only if you are developing for rclone. 1534 You need to have rclone source code locally to work with bisync tests. 1535 1536 Bisync has a dedicated test framework implemented in the `bisync_test.go` 1537 file located in the rclone source tree. The test suite is based on the 1538 `go test` command. Series of tests are stored in subdirectories below the 1539 `cmd/bisync/testdata` directory. Individual tests can be invoked by their 1540 directory name, e.g. 1541 `go test . -case basic -remote local -remote2 gdrive: -v` 1542 1543 Tests will make a temporary folder on remote and purge it afterwards. 1544 If during test run there are intermittent errors and rclone retries, 1545 these errors will be captured and flagged as invalid MISCOMPAREs. 1546 Rerunning the test will let it pass. Consider such failures as noise. 1547 1548 ### Test command syntax 1549 1550 ``` 1551 usage: go test ./cmd/bisync [options...] 1552 1553 Options: 1554 -case NAME Name(s) of the test case(s) to run. Multiple names should 1555 be separated by commas. You can remove the `test_` prefix 1556 and replace `_` by `-` in test name for convenience. 1557 If not `all`, the name(s) should map to a directory under 1558 `./cmd/bisync/testdata`. 1559 Use `all` to run all tests (default: all) 1560 -remote PATH1 `local` or name of cloud service with `:` (default: local) 1561 -remote2 PATH2 `local` or name of cloud service with `:` (default: local) 1562 -no-compare Disable comparing test results with the golden directory 1563 (default: compare) 1564 -no-cleanup Disable cleanup of Path1 and Path2 testdirs. 1565 Useful for troubleshooting. (default: cleanup) 1566 -golden Store results in the golden directory (default: false) 1567 This flag can be used with multiple tests. 1568 -debug Print debug messages 1569 -stop-at NUM Stop test after given step number. (default: run to the end) 1570 Implies `-no-compare` and `-no-cleanup`, if the test really 1571 ends prematurely. Only meaningful for a single test case. 1572 -refresh-times Force refreshing the target modtime, useful for Dropbox 1573 (default: false) 1574 -verbose Run tests verbosely 1575 ``` 1576 1577 Note: unlike rclone flags which must be prefixed by double dash (`--`), the 1578 test command flags can be equally prefixed by a single `-` or double dash. 1579 1580 ### Running tests 1581 1582 - `go test . -case basic -remote local -remote2 local` 1583 runs the `test_basic` test case using only the local filesystem, 1584 synching one local directory with another local directory. 1585 Test script output is to the console, while commands within scenario.txt 1586 have their output sent to the `.../workdir/test.log` file, 1587 which is finally compared to the golden copy. 1588 - The first argument after `go test` should be a relative name of the 1589 directory containing bisync source code. If you run tests right from there, 1590 the argument will be `.` (current directory) as in most examples below. 1591 If you run bisync tests from the rclone source directory, the command 1592 should be `go test ./cmd/bisync ...`. 1593 - The test engine will mangle rclone output to ensure comparability 1594 with golden listings and logs. 1595 - Test scenarios are located in `./cmd/bisync/testdata`. The test `-case` 1596 argument should match the full name of a subdirectory under that 1597 directory. Every test subdirectory name on disk must start with `test_`, 1598 this prefix can be omitted on command line for brevity. Also, underscores 1599 in the name can be replaced by dashes for convenience. 1600 - `go test . -remote local -remote2 local -case all` runs all tests. 1601 - Path1 and Path2 may either be the keyword `local` 1602 or may be names of configured cloud services. 1603 `go test . -remote gdrive: -remote2 dropbox: -case basic` 1604 will run the test between these two services, without transferring 1605 any files to the local filesystem. 1606 - Test run stdout and stderr console output may be directed to a file, e.g. 1607 `go test . -remote gdrive: -remote2 local -case all > runlog.txt 2>&1` 1608 1609 ### Test execution flow 1610 1611 1. The base setup in the `initial` directory of the testcase is applied 1612 on the Path1 and Path2 filesystems (via rclone copy the initial directory 1613 to Path1, then rclone sync Path1 to Path2). 1614 2. The commands in the scenario.txt file are applied, with output directed 1615 to the `test.log` file in the test working directory. 1616 Typically, the first actual command in the `scenario.txt` file is 1617 to do a `--resync`, which establishes the baseline 1618 `{...}.path1.lst` and `{...}.path2.lst` files in the test working 1619 directory (`.../workdir/` relative to the temporary test directory). 1620 Various commands and listing snapshots are done within the test. 1621 3. Finally, the contents of the test working directory are compared 1622 to the contents of the testcase's golden directory. 1623 1624 ### Notes about testing 1625 1626 - Test cases are in individual directories beneath `./cmd/bisync/testdata`. 1627 A command line reference to a test is understood to reference a directory 1628 beneath `testdata`. For example, 1629 `go test ./cmd/bisync -case dry-run -remote gdrive: -remote2 local` 1630 refers to the test case in `./cmd/bisync/testdata/test_dry_run`. 1631 - The test working directory is located at `.../workdir` relative to a 1632 temporary test directory, usually under `/tmp` on Linux. 1633 - The local test sync tree is created at a temporary directory named 1634 like `bisync.XXX` under system temporary directory. 1635 - The remote test sync tree is located at a temporary directory 1636 under `<remote:>/bisync.XXX/`. 1637 - `path1` and/or `path2` subdirectories are created in a temporary 1638 directory under the respective local or cloud test remote. 1639 - By default, the Path1 and Path2 test dirs and workdir will be deleted 1640 after each test run. The `-no-cleanup` flag disables purging these 1641 directories when validating and debugging a given test. 1642 These directories will be flushed before running another test, 1643 independent of the `-no-cleanup` usage. 1644 - You will likely want to add `- /testdir/` to your normal 1645 bisync `--filters-file` so that normal syncs do not attempt to sync 1646 the test temporary directories, which may have `RCLONE_TEST` miscompares 1647 in some testcases which would otherwise trip the `--check-access` system. 1648 The `--check-access` mechanism is hard-coded to ignore `RCLONE_TEST` 1649 files beneath `bisync/testdata`, so the test cases may reside on the 1650 synched tree even if there are check file mismatches in the test tree. 1651 - Some Dropbox tests can fail, notably printing the following message: 1652 `src and dst identical but can't set mod time without deleting and re-uploading` 1653 This is expected and happens due to the way Dropbox handles modification times. 1654 You should use the `-refresh-times` test flag to make up for this. 1655 - If Dropbox tests hit request limit for you and print error message 1656 `too_many_requests/...: Too many requests or write operations.` 1657 then follow the 1658 [Dropbox App ID instructions](/dropbox/#get-your-own-dropbox-app-id). 1659 1660 ### Updating golden results 1661 1662 Sometimes even a slight change in the bisync source can cause little changes 1663 spread around many log files. Updating them manually would be a nightmare. 1664 1665 The `-golden` flag will store the `test.log` and `*.lst` listings from each 1666 test case into respective golden directories. Golden results will 1667 automatically contain generic strings instead of local or cloud paths which 1668 means that they should match when run with a different cloud service. 1669 1670 Your normal workflow might be as follows: 1671 1. Git-clone the rclone sources locally 1672 2. Modify bisync source and check that it builds 1673 3. Run the whole test suite `go test ./cmd/bisync -remote local` 1674 4. If some tests show log difference, recheck them individually, e.g.: 1675 `go test ./cmd/bisync -remote local -case basic` 1676 5. If you are convinced with the difference, goldenize all tests at once: 1677 `go test ./cmd/bisync -remote local -golden` 1678 6. Use word diff: `git diff --word-diff ./cmd/bisync/testdata/`. 1679 Please note that normal line-level diff is generally useless here. 1680 7. Check the difference _carefully_! 1681 8. Commit the change (`git commit`) _only_ if you are sure. 1682 If unsure, save your code changes then wipe the log diffs from git: 1683 `git reset [--hard]`. 1684 1685 ### Structure of test scenarios 1686 1687 - `<testname>/initial/` contains a tree of files that will be set 1688 as the initial condition on both Path1 and Path2 testdirs. 1689 - `<testname>/modfiles/` contains files that will be used to 1690 modify the Path1 and/or Path2 filesystems. 1691 - `<testname>/golden/` contains the expected content of the test 1692 working directory (`workdir`) at the completion of the testcase. 1693 - `<testname>/scenario.txt` contains the body of the test, in the form of 1694 various commands to modify files, run bisync, and snapshot listings. 1695 Output from these commands is captured to `.../workdir/test.log` 1696 for comparison to the golden files. 1697 1698 ### Supported test commands 1699 1700 - `test <some message>` 1701 Print the line to the console and to the `test.log`: 1702 `test sync is working correctly with options x, y, z` 1703 - `copy-listings <prefix>` 1704 Save a copy of all `.lst` listings in the test working directory 1705 with the specified prefix: 1706 `save-listings exclude-pass-run` 1707 - `move-listings <prefix>` 1708 Similar to `copy-listings` but removes the source 1709 - `purge-children <dir>` 1710 This will delete all child files and purge all child subdirs under given 1711 directory but keep the parent intact. This behavior is important for tests 1712 with Google Drive because removing and re-creating the parent would change 1713 its ID. 1714 - `delete-file <file>` 1715 Delete a single file. 1716 - `delete-glob <dir> <pattern>` 1717 Delete a group of files located one level deep in the given directory 1718 with names matching a given glob pattern. 1719 - `touch-glob YYYY-MM-DD <dir> <pattern>` 1720 Change modification time on a group of files. 1721 - `touch-copy YYYY-MM-DD <source-file> <dest-dir>` 1722 Change file modification time then copy it to destination. 1723 - `copy-file <source-file> <dest-dir>` 1724 Copy a single file to given directory. 1725 - `copy-as <source-file> <dest-file>` 1726 Similar to above but destination must include both directory 1727 and the new file name at destination. 1728 - `copy-dir <src> <dst>` and `sync-dir <src> <dst>` 1729 Copy/sync a directory. Equivalent of `rclone copy` and `rclone sync`. 1730 - `list-dirs <dir>` 1731 Equivalent to `rclone lsf -R --dirs-only <dir>` 1732 - `bisync [options]` 1733 Runs bisync against `-remote` and `-remote2`. 1734 1735 ### Supported substitution terms 1736 1737 - `{testdir/}` - the root dir of the testcase 1738 - `{datadir/}` - the `modfiles` dir under the testcase root 1739 - `{workdir/}` - the temporary test working directory 1740 - `{path1/}` - the root of the Path1 test directory tree 1741 - `{path2/}` - the root of the Path2 test directory tree 1742 - `{session}` - base name of the test listings 1743 - `{/}` - OS-specific path separator 1744 - `{spc}`, `{tab}`, `{eol}` - whitespace 1745 - `{chr:HH}` - raw byte with given hexadecimal code 1746 1747 Substitution results of the terms named like `{dir/}` will end with 1748 `/` (or backslash on Windows), so it is not necessary to include 1749 slash in the usage, for example `delete-file {path1/}file1.txt`. 1750 1751 ## Benchmarks 1752 1753 _This section is work in progress._ 1754 1755 Here are a few data points for scale, execution times, and memory usage. 1756 1757 The first set of data was taken between a local disk to Dropbox. 1758 The [speedtest.net](https://speedtest.net) download speed was ~170 Mbps, 1759 and upload speed was ~10 Mbps. 500 files (~9.5 MB each) had been already 1760 synched. 50 files were added in a new directory, each ~9.5 MB, ~475 MB total. 1761 1762 Change | Operations and times | Overall run time 1763 --------------------------------------|--------------------------------------------------------|------------------ 1764 500 files synched (nothing to move) | 1x listings for Path1 & Path2 | 1.5 sec 1765 500 files synched with --check-access | 1x listings for Path1 & Path2 | 1.5 sec 1766 50 new files on remote | Queued 50 copies down: 27 sec | 29 sec 1767 Moved local dir | Queued 50 copies up: 410 sec, 50 deletes up: 9 sec | 421 sec 1768 Moved remote dir | Queued 50 copies down: 31 sec, 50 deletes down: <1 sec | 33 sec 1769 Delete local dir | Queued 50 deletes up: 9 sec | 13 sec 1770 1771 This next data is from a user's application. They had ~400GB of data 1772 over 1.96 million files being sync'ed between a Windows local disk and some 1773 remote cloud. The file full path length was on average 35 characters 1774 (which factors into load time and RAM required). 1775 1776 - Loading the prior listing into memory (1.96 million files, listing file 1777 size 140 MB) took ~30 sec and occupied about 1 GB of RAM. 1778 - Getting a fresh listing of the local file system (producing the 1779 140 MB output file) took about XXX sec. 1780 - Getting a fresh listing of the remote file system (producing the 140 MB 1781 output file) took about XXX sec. The network download speed was measured 1782 at XXX Mb/s. 1783 - Once the prior and current Path1 and Path2 listings were loaded (a total 1784 of four to be loaded, two at a time), determining the deltas was pretty 1785 quick (a few seconds for this test case), and the transfer time for any 1786 files to be copied was dominated by the network bandwidth. 1787 1788 ## References 1789 1790 rclone's bisync implementation was derived from 1791 the [rclonesync-V2](https://github.com/cjnaz/rclonesync-V2) project, 1792 including documentation and test mechanisms, 1793 with [@cjnaz](https://github.com/cjnaz)'s full support and encouragement. 1794 1795 `rclone bisync` is similar in nature to a range of other projects: 1796 1797 - [unison](https://github.com/bcpierce00/unison) 1798 - [syncthing](https://github.com/syncthing/syncthing) 1799 - [cjnaz/rclonesync](https://github.com/cjnaz/rclonesync-V2) 1800 - [ConorWilliams/rsinc](https://github.com/ConorWilliams/rsinc) 1801 - [jwink3101/syncrclone](https://github.com/Jwink3101/syncrclone) 1802 - [DavideRossi/upback](https://github.com/DavideRossi/upback) 1803 1804 Bisync adopts the differential synchronization technique, which is 1805 based on keeping history of changes performed by both synchronizing sides. 1806 See the _Dual Shadow Method_ section in 1807 [Neil Fraser's article](https://neil.fraser.name/writing/sync/). 1808 1809 Also note a number of academic publications by 1810 [Benjamin Pierce](http://www.cis.upenn.edu/%7Ebcpierce/papers/index.shtml#File%20Synchronization) 1811 about _Unison_ and synchronization in general. 1812 1813 ## Changelog 1814 1815 ### `v1.66` 1816 * Copies and deletes are now handled in one operation instead of two 1817 * `--track-renames` and `--backup-dir` are now supported 1818 * Partial uploads known issue on `local`/`ftp`/`sftp` has been resolved (unless using `--inplace`) 1819 * Final listings are now generated from sync results, to avoid needing to re-list 1820 * Bisync is now much more resilient to changes that happen during a bisync run, and far less prone to critical errors / undetected changes 1821 * Bisync is now capable of rolling a file listing back in cases of uncertainty, essentially marking the file as needing to be rechecked next time. 1822 * A few basic terminal colors are now supported, controllable with [`--color`](/docs/#color-when) (`AUTO`|`NEVER`|`ALWAYS`) 1823 * Initial listing snapshots of Path1 and Path2 are now generated concurrently, using the same "march" infrastructure as `check` and `sync`, 1824 for performance improvements and less [risk of error](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=4.%20Listings%20should%20alternate%20between%20paths%20to%20minimize%20errors). 1825 * Fixed handling of unicode normalization and case insensitivity, support for [`--fix-case`](/docs/#fix-case), [`--ignore-case-sync`](/docs/#ignore-case-sync), [`--no-unicode-normalization`](/docs/#no-unicode-normalization) 1826 * `--resync` is now much more efficient (especially for users of `--create-empty-src-dirs`) 1827 * Google Docs (and other files of unknown size) are now supported (with the same options as in `sync`) 1828 * Equality checks before a sync conflict rename now fall back to `cryptcheck` (when possible) or `--download`, 1829 instead of of `--size-only`, when `check` is not available. 1830 * Bisync no longer fails to find the correct listing file when configs are overridden with backend-specific flags. 1831 * Bisync now fully supports comparing based on any combination of size, modtime, and checksum, lifting the prior restriction on backends without modtime support. 1832 * Bisync now supports a "Graceful Shutdown" mode to cleanly cancel a run early without requiring `--resync`. 1833 * New `--recover` flag allows robust recovery in the event of interruptions, without requiring `--resync`. 1834 * A new `--max-lock` setting allows lock files to automatically renew and expire, for better automatic recovery when a run is interrupted. 1835 * Bisync now supports auto-resolving sync conflicts and customizing rename behavior with new [`--conflict-resolve`](#conflict-resolve), [`--conflict-loser`](#conflict-loser), and [`--conflict-suffix`](#conflict-suffix) flags. 1836 * A new [`--resync-mode`](#resync-mode) flag allows more control over which version of a file gets kept during a `--resync`. 1837 * Bisync now supports [`--retries`](/docs/#retries-int) and [`--retries-sleep`](/docs/#retries-sleep-time) (when [`--resilient`](#resilient) is set.) 1838 1839 ### `v1.64` 1840 * Fixed an [issue](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=1.%20Dry%20runs%20are%20not%20completely%20dry) 1841 causing dry runs to inadvertently commit filter changes 1842 * Fixed an [issue](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=2.%20%2D%2Dresync%20deletes%20data%2C%20contrary%20to%20docs) 1843 causing `--resync` to erroneously delete empty folders and duplicate files unique to Path2 1844 * `--check-access` is now enforced during `--resync`, preventing data loss in [certain user error scenarios](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=%2D%2Dcheck%2Daccess%20doesn%27t%20always%20fail%20when%20it%20should) 1845 * Fixed an [issue](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=5.%20Bisync%20reads%20files%20in%20excluded%20directories%20during%20delete%20operations) 1846 causing bisync to consider more files than necessary due to overbroad filters during delete operations 1847 * [Improved detection of false positive change conflicts](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=1.%20Identical%20files%20should%20be%20left%20alone%2C%20even%20if%20new/newer/changed%20on%20both%20sides) 1848 (identical files are now left alone instead of renamed) 1849 * Added [support for `--create-empty-src-dirs`](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=3.%20Bisync%20should%20create/delete%20empty%20directories%20as%20sync%20does%2C%20when%20%2D%2Dcreate%2Dempty%2Dsrc%2Ddirs%20is%20passed) 1850 * Added experimental `--resilient` mode to allow [recovery from self-correctable errors](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=2.%20Bisync%20should%20be%20more%20resilient%20to%20self%2Dcorrectable%20errors) 1851 * Added [new `--ignore-listing-checksum` flag](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=6.%20%2D%2Dignore%2Dchecksum%20should%20be%20split%20into%20two%20flags%20for%20separate%20purposes) 1852 to distinguish from `--ignore-checksum` 1853 * [Performance improvements](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=6.%20Deletes%20take%20several%20times%20longer%20than%20copies) for large remotes 1854 * Documentation and testing improvements