Skip to content

UnbreakableMJ/copy

Β 
Β 

Repository files navigation

copy

A modern, fast file copy tool for Linux with progress bars, resume capability, and more.

License: GPL-3.0-or-later CI

Features β€’ Installation β€’ Quick Start β€’ Documentation


Note

Personal fork. copy is a personal, modified fork of cpx by Bhuminjay Soni (@11happy) β€” rebranded from cpx to copy and adapted for my own use. It is not affiliated with or endorsed by the upstream project and is maintained on a best-effort basis. For the original, actively maintained tool, use 11happy/cpx.

Why copy?

copy is a modern replacement for the traditional cp command, built with Rust for maximum performance and safety on Linux systems.

one

Features

  • πŸš€ Fast parallel copying (upto 5x faster than cp benchmarks)
  • πŸ“Š Beautiful progress bars (customizable)
  • ⏸️ Resume interrupted transfers
  • πŸ›‘ Graceful Ctrl+C handling with resume hints four
  • 🎯 Exclude patterns (gitignore-style)
  • βš™οΈ Flexible configuration

Installation

Quick Install

curl -fsSL https://raw.githubusercontent.com/UnbreakableMJ/copy/main/install.sh | bash

Or with wget:

wget -qO- https://raw.githubusercontent.com/UnbreakableMJ/copy/main/install.sh | bash

Arch Linux (AUR)

A first-party PKGBUILD lives in packaging/aur/. Build and install it from a checkout:

cd packaging/aur && makepkg -si

An official AUR upload will track this PKGBUILD. (The older community cpx-copy package predates the rename.)

Nix / NixOS

This repo is a flake. Run or install copy straight from GitHub:

nix run github:UnbreakableMJ/copy -- --help
nix profile install github:UnbreakableMJ/copy

For a dev shell with the Rust toolchain, run nix develop.

GNU Guix

A guix.scm is provided. Guix builds offline, so vendor the crates once, then build:

cargo vendor guix/vendor
guix build -f guix.scm

(Needs a Guix rust β‰₯ 1.85 for edition 2024.)

Optional SELinux Support

The default feature set has no SELinux system dependency. Building with --features selinux-support requires libselinux development headers that provide selinux/selinux.h (for example, libselinux-devel or the equivalent package for your distribution).

From Source

cargo install --git https://github.com/UnbreakableMJ/copy
copy --version

Pre-built Binaries

Prebuilt Linux binaries are attached to each release. The current release is v0.1.5:

Target Asset
x86_64 (glibc) copy-linux-x86_64.tar.gz
x86_64 (musl, static) copy-linux-x86_64-musl.tar.gz
aarch64 copy-linux-aarch64.tar.gz
armv7 copy-linux-armv7.tar.gz
# Example: x86_64 (glibc)
curl -fsSL https://github.com/UnbreakableMJ/copy/releases/download/v0.1.5/copy-linux-x86_64.tar.gz | tar xz
./copy --version

Quick Start

Basic Usage

# Copy a file
copy source.txt dest.txt

# Copy directory recursively
copy -r source_dir/ dest_dir/

# exclude build artifacts
copy -r -e "node_modules" -e ".git" -e "target" my-project/ /backup/

# Resume interrupted transfer
copy -r --resume large_dataset/ /backup/

# Copy with full attribute preservation
copy -r -p=all photos/ /backup/photos/

See examples.md for detailed workflows and real-world scenarios.

Key Options

copy [OPTIONS] <SOURCE>... <DESTINATION>

Arguments:
  <SOURCE>...       Source file(s) or directory(ies)
  <DESTINATION>     Destination file or directory

Input/Output Options:
  -t, --target-directory <DIRECTORY>
                           Copy all SOURCE arguments into DIRECTORY
  -e, --exclude <PATTERN>  Exclude files matching pattern (supports globs, comma-separated)

Copy Behavior:
  -r, --recursive          Copy directories recursively
  -j <N>                   Number of parallel operations [default: 4]
      --resume             Resume interrupted transfers (checksum verified)
  -f, --force              Remove and retry if destination cannot be opened
  -i, --interactive        Prompt before overwrite
      --parents            Use full source file name under DIRECTORY
      --attributes-only    Copy only attributes, not file data
      --remove-destination Remove destination file before copying

Link and Symlink Options:
  -s, --symbolic-link [MODE]
                           Create symlinks instead of copying [auto|absolute|relative]
  -l, --link               Create hard links instead of copying
  -P, --no-dereference     Never follow symbolic links in SOURCE
  -L, --dereference        Always follow symbolic links in SOURCE
  -H, --dereference-command-line
                           Follow symbolic links only on command line

Preservation:
  -p, --preserve [ATTRS]   Preserve attributes [default|all|mode,timestamps,ownership,...]
                           Available: mode, ownership, timestamps, links, context, xattr

Backup and Reflink:
  -b, --backup [MODE]      Backup existing files [none|simple|numbered|existing]
      --reflink [WHEN]     CoW copy if supported [auto|always|never]

Configuration:
      --config <PATH>      Use custom config file
      --no-config          Ignore all config files

Other:
  -h, --help               Print help information
  -V, --version            Print version information

For complete usage examples, see examples.md

For complete option reference, run copy --help

Configuration

Set defaults with configuration files:

# Create config with defaults
copy config init

# View active configuration
copy config show

# See config file location
copy config path

Config locations (in priority order):

  1. ./copyconfig.toml (project-level)
  2. ~/.config/copy/copyconfig.toml (user-level)
  3. /etc/copy/copyconfig.toml (system-level, Unix only)

Example config (~/.config/copy/copyconfig.toml):

[exclude]
patterns = ["*.tmp", "*.log", "node_modules", ".git"]

[copy]
parallel = 8
recursive = false

[preserve]
mode = "default"

[progress]
style = "detailed"

[reflink]
mode = "auto"

See configuration.md for all options and use cases.

The move command

This project also ships a move binary β€” a modern mv replacement that reuses the same engine. It renames in place when possible (atomic, instant) and falls back to a copy + source removal only when the rename can't be done atomically (across filesystems, or when --exclude leaves part of a directory behind).

# Rename / move a file
move old.txt new.txt

# Move into a directory
move a.txt b.txt dest/
move -t dest/ a.txt b.txt

# Don't overwrite, prompt, or only move newer files
move -n src dst      # never overwrite
move -i src dst      # prompt before overwrite
move -u src dst      # only if source is newer
move -b src dst      # back up an existing destination

# Cross-filesystem move that skips logs and preserves attributes
move -e '*.log' -p project/ /mnt/backup/project/

Key options: -t/--target-directory, -i/--interactive, -f/--force, -n/--no-clobber, -u/--update, -b/--backup, -v/--verbose, and on the cross-device fallback -j, --reflink, -e/--exclude, -p/--preserve. Run move --help for the full reference. Both copy and move are installed together by every install method above.

Performance

copy is built for speed. Quick comparison:

Task cp copy -j16 speedup
VsCode (~15k files) 1084ms 263ms 4.12x
rust (~65k files) 4.553s 1.091s 4.17x

See benchmarks.md for detailed methodology and more comparisons.

Documentation

Platform Support

Platform Status Notes
Linux βœ… Supported Fast copy supported for (kernel 4.5+)
macOS πŸ”„ Planned To be released
Windows πŸ”„ Planned To be released

Quick Start for Developers

git clone https://github.com/UnbreakableMJ/copy.git
cd copy

# Run tests
cargo test

# Run clippy
cargo clippy

# Try it out
cargo run -- -r test_data/ test_dest/

Tests

Some tests are already ported from the GNU coreutils cp test suite, still porting more GNU ported tests.

This is a personal fork maintained on a best-effort basis; issue reports are welcome.

Project Posture

copy is a personal Spacecraft Software hobby project maintained on a best-effort basis for the maintainer's own use case. See NOTICE.md for the no-warranty/no-liability posture and CONTRIBUTING.md for contribution expectations.

License

GPL-3.0-or-later β€” see LICENSE. The upstream cpx code by Bhuminjay Soni was released under the MIT license; that license text is preserved in LICENSES/MIT.txt. Fork modifications are distributed under GPL-3.0-or-later.

Credits

copy is a fork of cpx by Bhuminjay Soni (@11happy). The original tool β€” its design and implementation β€” is entirely their work, reused here under the MIT license. This fork renames the binary to copy, flattens the CLI so copy is the root command, adds Nix / AUR / Guix packaging, and migrates the fork distribution to GPL-3.0-or-later; full credit for the underlying tool goes upstream. See CREDITS.md.

Acknowledgments

Inspired by ripgrep, fd, and the modern Rust CLI ecosystem.

Built with: clap, indicatif, rayon, jwalk, and more.


About

cp reimagined

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Rust 88.5%
  • Shell 8.9%
  • Scheme 1.5%
  • Nix 1.1%