Struct dircpy_stable::CopyBuilder[][src]

pub struct CopyBuilder {
    pub source: PathBuf,
    pub destination: PathBuf,
    // some fields omitted
}

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

impl CopyBuilder[src]

pub fn new<P: AsRef<Path>, Q: AsRef<Path>>(source: P, dest: Q) -> CopyBuilder[src]

Construct a new CopyBuilder with source and dest.

pub fn overwrite(self, overwrite: bool) -> CopyBuilder[src]

Overwrite target files (off by default)

pub fn overwrite_if_newer(self, overwrite_only_newer: bool) -> CopyBuilder[src]

Overwrite if the source is newer (off by default)

pub fn overwrite_if_size_differs(
    self,
    overwrite_if_size_differs: bool
) -> CopyBuilder
[src]

Overwrite if size between source and dest differs (off by default)

pub fn with_exclude_filter(self, f: &str) -> CopyBuilder[src]

Do not copy files that contain this string

pub fn with_include_filter(self, f: &str) -> CopyBuilder[src]

Only copy files that contain this string.

pub fn run(&self) -> Result<(), Error>[src]

Execute the copy operation

Trait Implementations

impl Clone for CopyBuilder[src]

impl Debug for CopyBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.