<p align="center">
<img src="logo.png" width="256">
</p>
<h2 align="center">
recursive_copy - A minimalist, dependency-free library for performing secure
recursive file and directory copies on Unix-like systems</h2>
## β¨ Features
* Fully recursive copy of directories and files.
* Basic protection against symlink loops.
* Configurable recursion depth limit (`max_depth`).
* Optional overwrite, symlink following, and permission preservation.
* Efficient I/O with adjustable buffer size.
* Safe defaults for minimal risk operations.
## π§± Compatibility
* **Supported platforms:** Linux, *BSD systems, Solaris.
* **Requirements:** A POSIX-compliant filesystem interface.
* **Not supported:** Windows (by design).
This crate uses only the Rust standard library and POSIX APIs (via `std::os::unix`),
ensuring consistent behavior across Unix environments.
## βοΈ Example
```rust
use recursive_copy::{copy_recursive, CopyOptions};
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let src = Path::new("/home/user/docs");
let dst = Path::new("/backup/docs_copy");
let opts = CopyOptions::default();
let summary = copy_recursive(src, dst, &opts)?;
println!("Copied {} bytes with {} errors", summary.bytes_copied, summary.errors);
Ok(())
}
```
## π Security & Safety
* Prevents infinite recursion via a **symlink loop detector**.
* Enforces a **maximum directory depth**.
* Avoids accidental overwrites unless explicitly allowed.
* Supports **permission preservation** using POSIX `mode` bits.
## π§© Philosophy
This project follows a **minimalist design philosophy**:
* **No dependencies** β relies solely on the Rust standard library.
* **Stable behavior** β safe for system utilities, backups, and embedded tools.
* **Secure by default** β cautious handling of links, files, and permissions.
## π€ Contributing
Contributions are welcome! However, the projectβs core principles
are **minimalism, security, and stability**.
Please note:
* New functionality should only be added behind **optional feature flags**.
* The **default build** must remain dependency-free and minimal.
* Focus on code clarity and POSIX compliance.
## π License
Licensed under the MIT License.