LinuxCommandLibrary

robo

Robustly copy files and directories

TLDR

List available commands

$ robo list
copy

Run a specific command
$ robo [foo]
copy

Simulate running a specific command
$ robo --simulate [foo]
copy

SYNOPSIS

rclone copy source:path dest:path [flags]
robocopy-linux source destination [options]

PARAMETERS

source:path or source
    Specifies the source directory or remote path. For rclone, it includes the remote name and path. For robocopy-linux, it is the source directory path.

dest:path or destination
    Specifies the destination directory or remote path. For rclone, it includes the remote name and path. For robocopy-linux, it is the destination directory path.

--max-age duration (rclone)
    Only copy files older than this duration (e.g., 30d, 2w, 1y).

--min-age duration (rclone)
    Only copy files younger than this duration.

/MIR (robocopy-linux)
    Mirrors a directory tree (equivalent to /E plus /PURGE).

/E (robocopy-linux)
    Copies subdirectories, including empty ones.

/PURGE (robocopy-linux)
    Deletes destination files/directories that no longer exist in the source.

/MAXAGE:n (robocopy-linux)
    Specifies the maximum file age (only files older than n days are copied).

--transfers n (rclone)
    Number of file transfers to run in parallel. Defaults to 4.

--checkers n (rclone)
    Number of checkers to run in parallel. Defaults to 8.

--retries n (rclone)
    Retry operations this many times if they fail. Defaults to 3.

DESCRIPTION

Robocopy, short for Robust File Copy, is a command-line directory replication command. It's available for Linux through implementations such as rclone or direct ports like Robocopy-Linux. Robocopy excels at copying files and directory trees, providing features beyond basic copy commands. These include resuming interrupted transfers, skipping files based on criteria like size or modification date, preserving file attributes and timestamps, and mirroring directory structures. It is significantly more resilient to network interruptions compared to standard copy tools, retrying failed copies and logging errors. This makes it ideal for backups, migrations, and large-scale file transfers. Robocopy offers fine-grained control over the copy process, allowing users to specify retry counts, wait times, logging levels, and numerous other parameters. The Linux implementations strives to deliver similar features and performance to the original Windows tool.

It is important to note that direct availability of the Windows Robocopy command on Linux systems is not possible. Alternative implementations replicate Robocopy's functionality, making it a widely used tool for file management tasks on Linux.

CAVEATS

Robocopy implementations vary across Linux distributions. The exact syntax and available options might differ. Consult the specific documentation for the implementation you are using, such as `rclone help copy` or the `robocopy-linux` README. Also be aware of permissions when copying to different systems or locations.

<B>ERROR HANDLING</B>

Robocopy's superior error handling makes it stand out. It automatically retries failed transfers, logs errors, and provides detailed status reports, allowing for easier identification and resolution of issues. Implementations for Linux maintain this robust error handling behavior.

<B>PERFORMANCE CONSIDERATIONS</B>

When copying large amounts of data, consider using the `--transfers` flag (rclone) or equivalent options in other implementations to increase the number of parallel transfers. However, be mindful of network bandwidth and system resources. Experiment to find the optimal setting for your environment.

HISTORY

The original Robocopy was introduced by Microsoft as part of the Windows NT 4.0 Resource Kit. It quickly gained popularity due to its robustness and advanced features compared to the standard `copy` command. On Linux, various open-source projects have emerged to replicate Robocopy's functionality, offering similar capabilities for copying and synchronizing files across different systems and storage services. Rclone is used for copying data to and from cloud storage.

SEE ALSO

cp(1), rsync(1), scp(1)

Copied to clipboard