pub async fn copy_dir_recursive(from_dir: PathBuf, to_dir: PathBuf) -> Result<()> {
    if !path_exists(&from_dir).await? {
        return Err(anyhow!("directory can not be copied as it does not exist {:?}", &from_dir));
    }

    spawn_blocking(move || -> Result<()> {
        let opts = fs_extra::dir::CopyOptions {
            overwrite: true,
            content_only: true,
            ..Default::default()
        };
        let _ = fs_extra::dir::copy(from_dir, to_dir, &opts).context("error copying directory")?;
        Ok(())
    })
    .await
    .context("error copying directory")
}
/// A utility function to recursively copy a directory.
A utility function to recursively copy a directory.
A utility function to recursively copy a directory .
pub async fn copy_dir_recursive(from_dir: PathBuf, to_dir: PathBuf) -> Result<()> {
    if !path_exists(&from_dir).await? {
        return Err(anyhow!("directory can not be copied as it does not exist {:?}", &from_dir));
    }
    spawn_blocking(move || -> Result<()> {
        let opts = fs_extra::dir::CopyOptions {
            overwrite: true,
            content_only: true,
            ..Default::default()
        };
        let _ = fs_extra::dir::copy(from_dir, to_dir, &opts).context("error copying directory")?;
        Ok(())
    })
    .await
    .context("error copying directory")
}
pub async fn copy_dir_recursive ( from_dir : PathBuf , to_dir : PathBuf ) -> Result < ( ) > { if ! path_exists ( & from_dir ) . await ? { return Err ( anyhow ! ( " " from_dir ) ) ; } spawn_blocking ( move | | -> Result < ( ) > { let opts = fs_extra :: dir :: CopyOptions { overwrite : true , content_only : true , .. Default :: default ( ) } ; let _ = fs_extra :: dir :: copy ( from_dir , to_dir , & opts ) . context ( " " ) ? ; Ok ( ( ) ) } ) . await . context ( " " ) }
A utility function to recursively copy a directory.
A utility function to recursively copy a directory .
from_dir
PathBuf
to_dir
PathBuf
from_dir
PathBuf
to_dir
PathBuf