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: PathBuf
The source directory
destination: PathBuf
The 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§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