Just remove dupes, don't move them.

This commit is contained in:
Bill Thiede 2022-07-23 21:06:22 -07:00
parent e16d899c14
commit c46ae525fc

View File

@ -1,11 +1,6 @@
use std::collections::HashMap; use std::{collections::HashMap, error::Error, io::Write, path::Path, time::Duration};
use std::error::Error;
use std::io::Write;
use std::path::Path;
use std::time::Duration;
use human_format::Formatter; use human_format::{Formatter, Scales};
use human_format::Scales;
use humantime; use humantime;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use log::info; use log::info;
@ -13,9 +8,7 @@ use regex::Regex;
use structopt::StructOpt; use structopt::StructOpt;
use tabwriter::TabWriter; use tabwriter::TabWriter;
use superdeduper::clean_path_parent; use superdeduper::{clean_path_parent, CompactMetadata, MovieLibrary};
use superdeduper::CompactMetadata;
use superdeduper::MovieLibrary;
const MOVIE_DIR: &str = "/home/wathiede/Movies"; const MOVIE_DIR: &str = "/home/wathiede/Movies";
const TO_BE_REMOVED_DIR: &str = "/home/wathiede/to-be-deleted/"; const TO_BE_REMOVED_DIR: &str = "/home/wathiede/to-be-deleted/";
@ -71,11 +64,7 @@ fn print_dupes(lib: &MovieLibrary) {
delete_paths.sort(); delete_paths.sort();
let root = Path::new(&lib.root); let root = Path::new(&lib.root);
for path in &delete_paths { for path in &delete_paths {
println!( println!(r#"rm "{}""#, root.join(path).to_string_lossy(),);
r#"mv "{}" {}"#,
root.join(path).to_string_lossy(),
TO_BE_REMOVED_DIR
);
} }
if delete_paths.len() > 0 { if delete_paths.len() > 0 {
println!("superdeduper update-compact-metadata && superdeduper empty-dirs") println!("superdeduper update-compact-metadata && superdeduper empty-dirs")
@ -154,7 +143,7 @@ fn print_videos(videos: &HashMap<String, CompactMetadata>, filter: Option<&Regex
humantime::Duration::from(Duration::from_secs(md.duration as u64)), humantime::Duration::from(Duration::from_secs(md.duration as u64)),
&name[MOVIE_DIR.len() + 1..] &name[MOVIE_DIR.len() + 1..]
); );
println!("mv '{}' '{}'", name, TO_BE_REMOVED_DIR); println!("rm '{}'", name);
} }
} }