fs_extra

Expanded std::fs and std::io for Rust — recursive copy and move with progress reporting.

Library
Cargo
v1.3.0
335stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
40/100Fair
Development Activity0
Maintenance20
Community60
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture80
Code Quality85
Innovation82
Learning Curve88

fs_extra is a dependency-free Rust library that fills the gaps in the standard library’s std::fs and std::io modules. It adds the higher-level file and directory operations that real applications need but that std leaves out: recursively copying and moving whole directory trees, reporting live progress through callbacks, computing folder sizes, and enumerating directory contents with rich metadata.

Every operation is offered in both a simple form and a with_progress variant that streams TransitProcess information back to the caller, making it straightforward to build responsive CLIs and GUIs that show copy/move progress. With zero third-party dependencies and a small, well-documented surface area, fs_extra is a lightweight drop-in for filesystem-heavy Rust code.

What You Get

  • Recursive directory copy and move via dir::copy, dir::move_dir, copy_items, and move_items
  • Progress-aware variants (copy_with_progress, move_dir_with_progress) that stream TransitProcess updates for building responsive UIs
  • Configurable CopyOptions (overwrite, skip_exist, buffer_size, content_only) that control how conflicts and buffering are handled
  • Directory introspection helpers: dir::get_size, dir::get_dir_content, and dir::ls for sizes and child-entry details
  • Convenience file helpers such as file::read_to_string and file::write_all, plus a typed Error/ErrorKind result type

Common Use Cases

  • Copying or moving large directory trees while displaying a progress bar in a CLI or GUI
  • Computing the total on-disk size of a folder before an operation
  • Building installers, backup tools, and file-sync utilities that need recursive filesystem operations
  • Listing directory contents with per-entry metadata for file explorers or asset pipelines

Under The Hood

Architecture The crate is organized into four flat modules — lib.rs (top-level copy_items/move_items/remove_items orchestration), dir.rs (recursive directory logic, the largest file at ~46KB), file.rs (single-file copy/move/read/write with CopyOptions), and error.rs (a custom Error/ErrorKind result type). Higher-level functions in lib.rs walk entries and delegate down to the file and dir primitives, and every mutating operation has a mirror *_with_progress form that threads a caller-supplied handler receiving a TransitProcess struct of byte and entry counts.

Tech Stack Pure Rust targeting edition 2018 with zero third-party dependencies — it builds entirely on std::fs and std::io. Progress buffering is tunable through CopyOptions.buffer_size (default 64KB). The only tooling is Cargo plus a legacy Travis CI config.

Code Quality The library is exceptionally well tested: roughly 9,700 lines of integration tests across tests/dir.rs, tests/file.rs, and tests/lib.rs against ~90KB of source. Errors are handled through a purpose-built ErrorKind enum that categorizes NotFound, PermissionDenied, AlreadyExists, InvalidFolder, and wrapped Io/StripPrefix/OsString failures rather than leaking raw std errors. Naming is consistent and the public functions carry doc comments with runnable examples.

API Design The public API is small, discoverable, and ergonomic: builder-style CopyOptions methods (overwrite, skip_exist, buffer_size) chain fluently, and the simple-vs-with_progress pairing lets users start trivially and opt into progress reporting without changing call sites. The README documents every function in a table with docs.rs links, so getting started requires almost no boilerplate.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search