| Crates.io | cp_docs |
| lib.rs | cp_docs |
| version | 1.0.1 |
| created_at | 2025-09-29 16:57:41.76724+00 |
| updated_at | 2025-09-29 16:57:41.76724+00 |
| description | A small tool to find and copy docs/ directories recursively |
| homepage | |
| repository | https://github.com/bhanuwealthy/docs-helper |
| max_upload_size | |
| id | 1859873 |
| size | 18,967 |
cp_docs is a small Rust command-line tool.
It recursively finds all docs/ directories within a specified path and copies their contents to a target directory, preserving the original folder structure.
Rust (https://www.rust-lang.org/)
Cargo (Rust's package manager)
cargo install cp_docs
git clone https://github.com/bhanuwealthy/docs-helper.git
cd docs-helper
cargo build --release
$ cp_docs <source> <target>
# OR cargo run
$ cargo r -- ../docs-test ../docs-test-result
$ tree ../docs-test ../docs-test-result
# src dir
../docs-test
└── A
├── B
│ ├── C
│ │ └── docs
│ │ ├── a-b-c.md
│ │ └── c.md
│ └── docs
│ ├── E
│ │ ├── a-b-e.md
│ │ └── e.md
│ └── b.md
├── D
│ └── d.md
└── docs
└── A.md
# target dir
../docs-test-result
└── A
├── A.md
└── B
├── C
│ ├── a-b-c.md
│ └── c.md
├── E
│ ├── a-b-e.md
│ └── e.md
└── b.md
8 directories, 6 files
Prefer cargo install or cargo run Over dockerTo use docs-helper within a Docker container, follow these steps:
Build the Docker image:
Navigate to the root of your docs-helper project (where the Dockerfile is located) in your terminal and run:
docker build -t cp_docs .
This command builds a Docker image named cp_docs.
Run the Docker container:
You'll need to mount your source and target directories from your host machine into the container using volume mounts (-v).
Example:
If your project with docs/ folders is in my_project_root on your host and you want the output in my_project_root/dist:
# From your 'my_project_root' directory
docker run -v $(pwd):/app/source_code -v $(pwd)/dist:/app/output_docs cp_docs /app/source_code /app/output_docs
-v $(pwd):/app/source_code: Mounts your current host directory ($(pwd)) as /app/source_code inside the container. This should be the root path where cp_docs will start searching for docs/ directories.
-v $(pwd)/dist:/app/output_docs: Mounts your host's dist directory as /app/output_docs inside the container. This is where the processed documentation will be written.
cp_docs: The name of the Docker image you built.
/app/source_code /app/output_docs: These are the arguments passed to the cp_docs executable inside the container, specifying the root to scan and the target output directory, respectively.