Skip to content
Snippets Groups Projects
Commit 5bcaafba authored by nfontrod's avatar nfontrod
Browse files

src/checkout.rs: fix rm problem

parent 2bb71db4
No related branches found
No related tags found
No related merge requests found
......@@ -137,8 +137,9 @@ pub fn remove_results(borg_path: &PathBuf, results: &PathBuf) {
let cmd = if !has_ignore {
format!("rm -r {}/*", results.to_str().unwrap())
} else {
format!("find {} -name '*' -type f | egrep -v -f {} | xargs rm 2>> /dev/null; find results -name '*' -type d | grep -v results | xargs rm -d 2>> /dev/null", results.to_str().unwrap(), borgignore.to_str().unwrap())
format!("find {} -name '*' -type f | egrep -v -f {} | xargs rm 2>> /dev/null; find results -name '*' -type d | grep -v -P '^results$' | xargs rm -d 2>> /dev/null", results.to_str().unwrap(), borgignore.to_str().unwrap())
};
println!("{}", cmd);
let output = Command::new("sh").arg("-c").arg(cmd).output().unwrap();
match output.status.code().unwrap() {
0 => (),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment