MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / copy_all

Function copy_all

flow-quickstart/src/git.rs:234–247  ·  view source on GitHub ↗
(src: impl AsRef<Path>, dst: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

232 Ok(())
233 }
234 fn copy_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> {
235 fs::create_dir_all(&dst)?;
236 for src_entry in fs::read_dir(src)? {
237 let src_entry = src_entry?;
238 let dst_path = dst.as_ref().join(src_entry.file_name());
239 let entry_type = src_entry.file_type()?;
240 if entry_type.is_dir() {
241 copy_dir_all(src_entry.path(), dst_path)?;
242 } else if entry_type.is_file() {
243 fs::copy(src_entry.path(), dst_path)?;
244 }
245 }
246 Ok(())
247 }
248
249 check_dir_all(&src, &dst)?;
250 copy_all(src, dst)

Callers 1

copy_dir_allFunction · 0.85

Calls 2

copy_dir_allFunction · 0.85
as_refMethod · 0.80

Tested by

no test coverage detected