Quick fix for deleting old backups

+ This should be refactored in the future
backup_error_fix
Joey Hines 2020-10-30 08:09:00 -05:00
parent cc85d287ef
commit 9b6fe56541
1 changed files with 1 additions and 1 deletions

View File

@ -252,7 +252,7 @@ fn get_time_from_file_name(
archive_entry: &DirEntry, archive_entry: &DirEntry,
) -> Result<Option<NaiveDateTime>, std::io::Error> { ) -> Result<Option<NaiveDateTime>, std::io::Error> {
let file_name = archive_entry.file_name().to_str().unwrap().to_string(); let file_name = archive_entry.file_name().to_str().unwrap().to_string();
let name: Vec<&str> = file_name.split('_').collect(); let name: Vec<&str> = file_name.split("_backup.tar.gz").collect();
Ok(chrono::NaiveDateTime::parse_from_str(name[0], "%d-%m-%y_%H.%M.%S").ok()) Ok(chrono::NaiveDateTime::parse_from_str(name[0], "%d-%m-%y_%H.%M.%S").ok())
} }