Rclone is a command-line program to manage files on cloud storage. It is a feature-rich alternative to cloud vendors' web storage interfaces. Over 70 cloud storage products support rclone including S3 object stores, business & consumer file storage services, as well as standard transfer protocols.

!!! warning "Be Mindful of Sync Type"
    The `bisync` command is meant to keep multiple locations synced with eachother, while in contrast the `sync` command forces the source to overwrite the destination.  If you just want to dump the source into the destination on top of existing data, use the `copy` command within rclone.

## Usage Overview
There is a lot to keep in mind when using rclone, primarily with the `sync` command.  You can find more information in the [Official Documentation](https://rclone.org/commands/)

## rClone `bisync` Implementation
Perform bi-directional synchronization between two locations (e.g. `Local` and `Remote`).  Bisync provides a bi-directional cloud sync solution in rclone. It retains the file structure and history data in both the `Local` and `Remote` locations from the first time you run bisync. 

### Example Usage
The following commands illustrate how to use bisync to synchronize a local folder and a remote folder (assumed to be Google Drive).  

!!! example "Explanation of Command Arguments"

    - `--drive-skip-gdocs`: This prevents the sync from syncing Google Drive specific documents such as `*.gsheet`, `*.gdoc`, etc.  
    - `--resilient`: This means that if there are network interruptions, rclone will attempt to recover on its own automatically.
    - `--conflict-resolve newer`: This is how the bisync determines how to declare a "*winner*" and a "*loser*". 
        - The winner being the newer file, and the loser being the older file.
    - `--conflict-loser delete`: This is the action to perform to the older file when a conflict is found in either direction.
    - `--update`: This skips files that are newer on the destination, allowing us to ensure that the newest changes on the remote storage are pulled down before performing our first bisync.

=== "Initial Sync"
    We want to first sync down any files that are from the remote location (Google Drive/Remote Folder/Network Share/etc) and overwrite any local files with the newer files.  This ONLY overwrites local files that are older than the remote files, but if the local files are newer, they are left alone.  

    ```powershell
    .\rclone.exe sync "Remote" "Local" --update --log-level INFO --drive-skip-gdocs --create-empty-src-dirs --progress
    ```
        
=== "Subsequent Syncs"
    At this point, the local directory has the newest remote version of all of the files that exist in both locations, so if anyone made changes to a file in Google Drive, and those changes are newer than the local files, it overwrites the local files, but if the local files were newer, they were left alone.  This second command performs the first and all subsequent bisyncs, with conflict resolution, meaning:
    
    - If the remote file was newer, it deletes the older local file and overwrites it with the newer remote file, 
    - If the local file was newer, it deletes the older remote file and overwrites it with the newer local file
    ```powershell
    .\rclone.exe bisync "Local" "Remote" --create-empty-src-dirs --conflict-resolve newer --conflict-loser delete --compare size,modtime,checksum --resilient --log-level ERROR --drive-skip-gdocs --fix-case --force --progress
    ```