Function rfm::rm[][src]

pub fn rm(from: &Vec<&PathBuf>) -> Result<()>
Expand description

Deletes files/directories (including nested files/directories). from - takes a list of paths of what you want to delete.

Errors

This function will return an error in the following situations, but is not limited to just these case:

  • Param from contains file or directory does not exist.
  • Param from contains file or directory with invalid name.
  • The current process does not have the permission to access to input params.

Example

ⓘ
 extern crate rfm;
 use rfm::rm;

 let dir = std::path::Path::new("./dir").to_path_buf();
 let file = std::path::Path::new("./file.txt").to_path_buf();
 let elements: Vec<&std::path::PathBuf> = vec![&dir, &file];

 rm(&elements)?;