1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
use crate::error::*;
use std::path::PathBuf;
/// Function to delete files
pub fn remove(target: Vec<PathBuf>) -> Result<()> {
target.iter().for_each(|content| {
if content.is_file() {
std::fs::remove_file(&content).unwrap();
}
if content.is_dir() {
std::fs::remove_dir_all(&content).unwrap();
}
});
Ok(())
}