handle some documents
This commit is contained in:
parent
e6b9b927f4
commit
c311f3c2cb
35
src/main.rs
35
src/main.rs
|
@ -61,6 +61,10 @@ fn yes() -> bool {
|
|||
answer.to_lowercase().starts_with("y")
|
||||
}
|
||||
|
||||
fn handle_document(file: DirEntry) {
|
||||
move_file(file.path(), documents_dir());
|
||||
}
|
||||
|
||||
fn handle_image(file: DirEntry) {
|
||||
move_file(file.path(), pictures_dir());
|
||||
}
|
||||
|
@ -177,20 +181,23 @@ fn handle_dir(path: PathBuf) {
|
|||
|
||||
if let Some(extension) = inode.path().extension().unwrap_or("none".as_ref()).to_str() {
|
||||
match extension.to_string().to_lowercase().as_ref() {
|
||||
"gif" => { handle_gif( inode) }
|
||||
"jpg" => { handle_image(inode) }
|
||||
"jpeg" => { handle_image(inode) }
|
||||
"png" => { handle_image(inode) }
|
||||
"iso" => { handle_iso( inode) }
|
||||
"mp3" => { handle_mp3( inode) }
|
||||
"pdf" => { handle_pdf( inode) }
|
||||
"avi" => { handle_video(inode) }
|
||||
"m4v" => { handle_video(inode) }
|
||||
"mkv" => { handle_video(inode) }
|
||||
"mp4" => { handle_video(inode) }
|
||||
// todo m4a, flac, etc?
|
||||
// todo pdf, other documents
|
||||
_ => { /*println!("Here's where we would do nothing.");*/ }
|
||||
"doc" => { handle_document(inode) }
|
||||
"docx" => { handle_document(inode) }
|
||||
"odt" => { handle_document(inode) }
|
||||
"rtf" => { handle_document(inode) }
|
||||
"gif" => { handle_gif( inode) }
|
||||
"jpg" => { handle_image( inode) }
|
||||
"jpeg" => { handle_image( inode) }
|
||||
"png" => { handle_image( inode) }
|
||||
"iso" => { handle_iso( inode) }
|
||||
"mp3" => { handle_mp3( inode) }
|
||||
"pdf" => { handle_pdf( inode) }
|
||||
"avi" => { handle_video( inode) }
|
||||
"m4v" => { handle_video( inode) }
|
||||
"mkv" => { handle_video( inode) }
|
||||
"mp4" => { handle_video( inode) }
|
||||
// todo other documents
|
||||
_ => { println!("Not sure what to do with file: {:?}.", inode.path()); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue