Struct dircpy::CopyBuilder
source · pub struct CopyBuilder {
pub source: PathBuf,
pub destination: PathBuf,
/* private fields */
}Expand description
Recursively copy a directory from a to b.
use dircpy::*;
// Most basic example:
copy_dir("src", "dest");
// Simple builder example:
CopyBuilder::new("src", "dest")
.run()
.unwrap();
// Copy recursively, only including certain files:
CopyBuilder::new("src", "dest")
.overwrite_if_newer(true)
.overwrite_if_size_differs(true)
.with_include_filter(".txt")
.with_include_filter(".csv")
.run()
.unwrap();Fields§
§source: PathBufThe source directory
destination: PathBufThe destination directory
Implementations§
source§impl CopyBuilder
impl CopyBuilder
sourcepub fn new<P: AsRef<Path>, Q: AsRef<Path>>(source: P, dest: Q) -> CopyBuilder
pub fn new<P: AsRef<Path>, Q: AsRef<Path>>(source: P, dest: Q) -> CopyBuilder
Construct a new CopyBuilder with source and dest.
sourcepub fn overwrite(self, overwrite: bool) -> CopyBuilder
pub fn overwrite(self, overwrite: bool) -> CopyBuilder
Overwrite target files (off by default)
sourcepub fn overwrite_if_newer(self, overwrite_only_newer: bool) -> CopyBuilder
pub fn overwrite_if_newer(self, overwrite_only_newer: bool) -> CopyBuilder
Overwrite if the source is newer (off by default)
sourcepub fn overwrite_if_size_differs(
self,
overwrite_if_size_differs: bool,
) -> CopyBuilder
pub fn overwrite_if_size_differs( self, overwrite_if_size_differs: bool, ) -> CopyBuilder
Overwrite if size between source and dest differs (off by default)
sourcepub fn with_exclude_filter(self, f: &str) -> CopyBuilder
pub fn with_exclude_filter(self, f: &str) -> CopyBuilder
Do not copy files that contain this string
sourcepub fn with_include_filter(self, f: &str) -> CopyBuilder
pub fn with_include_filter(self, f: &str) -> CopyBuilder
Only copy files that contain this string.
Trait Implementations§
source§impl Clone for CopyBuilder
impl Clone for CopyBuilder
source§fn clone(&self) -> CopyBuilder
fn clone(&self) -> CopyBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CopyBuilder
impl RefUnwindSafe for CopyBuilder
impl Send for CopyBuilder
impl Sync for CopyBuilder
impl Unpin for CopyBuilder
impl UnwindSafe for CopyBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more