GNU coreutils-compatible file copy with zero-copy kernel I/O, parallel directory traversal, sparse file detection, and reflink support.
Full GNU cp compatibility with modern kernel optimizations, parallel I/O, and a robust copy engine with automatic fallback.
Uses copy_file_range, sendfile, and FICLONE (reflink) syscalls to avoid unnecessary user-space memory copies.
Rayon-powered parallel traversal with openat/mkdirat/readdir raw syscalls. Threshold auto-switches at 64 entries.
Uses SEEK_HOLE/SEEK_DATA to preserve file holes. Supports --sparse=auto|always|never modes.
Preserves mode, ownership, timestamps (nanosecond), xattr, ACL, and hard links with correct ordering to avoid permission races.
Instant copy-on-write cloning on Btrfs, XFS, and APFS via FICLONE ioctl. Falls back transparently when unsupported.
Drop-in replacement with all standard flags: -a, -R, -p, -f, -n, -u, --backup, --sparse, --reflink, and more.
Beautiful --progress indicator powered by indicatif. Real-time throughput and ETA display for large transfers.
Numbered (.~1~), simple (~), or existing-mode backups. Respects VERSION_CONTROL and SIMPLE_BACKUP_SUFFIX environment variables.
Same-file detection via inode, symlink loop protection, TOCTOU-safe operations, setuid handling, and path traversal prevention.
From CLI arguments to kernel syscalls — every stage optimized for throughput.
CopyOptions structopenat/readdirwalkdir iteratorEach method is tried in order — first success wins
Head-to-head comparison on Linux 6.18 — averaged over 3 runs of 5 iterations each. Lower is faster.
-a (preserve all)
copy_file_range
-a
--sparse=auto
Cold-start time for a 1-byte file copy (50 runs avg): ~0.9 ms
168 tests across 12 suites — covering unit, integration, security, and performance benchmarks. All passing on every commit.
TOCTOU race conditions, symlink escape, path traversal, setuid handling, hardlink bombs, circular symlinks, umask leaks, and permission escalation checks.
Byte-for-byte comparison against GNU cp: single file, recursive, metadata preservation, error messages, exit codes, and verbose output format.
Large files, many small files, mixed sizes, deep trees, symlinks, hardlinks, sparse files, parallel threshold sweep, and startup overhead measurement.
Drop-in replacement for GNU cp. All standard POSIX and GNU flags supported.
| Flag | Description |
|---|---|
| -a, --archive | Same as -dR --preserve=all |
| -R, -r, --recursive | Copy directories recursively |
| -p | Preserve mode, ownership, timestamps |
| -f, --force | Remove destination before copy if needed |
| -n, --no-clobber | Do not overwrite existing files |
| -u, --update | Copy only when source is newer |
| -v, --verbose | Explain what is being done |
| -l, --link | Hard link files instead of copying |
| -s, --symbolic-link | Create symlinks instead of copying |
| -L, --dereference | Always follow symlinks in source |
| -P, --no-dereference | Never follow symlinks in source |
| --preserve=ATTR | Preserve: mode, ownership, timestamps, links, xattr, all |
| --no-preserve=ATTR | Don't preserve specified attributes |
| --sparse=WHEN | Control sparse file creation: auto, always, never |
| --reflink=WHEN | Control CoW cloning: auto, always, never |
| --backup[=CONTROL] | Make backup: numbered, existing, simple, none |
| -S, --suffix | Override backup suffix (default: ~) |
| -x, --one-file-system | Stay on the same filesystem |
| -t, --target-directory | Copy all sources into directory |
| -T, --no-target-directory | Treat destination as normal file |
| --parents | Replicate source path structure under dest |
| --attributes-only | Copy metadata only, no file data |
| --remove-destination | Remove each existing destination before copy |
| --debug | Show copy method used (implies -v) |
| --progress | Show progress bar during copy |
Clean module separation — each concern isolated in its own file.