Make --changed-within/before work for directories

closes #470
This commit is contained in:
sharkdp 2019-09-15 16:23:14 +02:00 committed by David Peter
parent 50fca2dca2
commit 08fcd7ce59
1 changed files with 6 additions and 8 deletions

View File

@ -365,14 +365,12 @@ fn spawn_senders(
// Filter out unwanted modification times // Filter out unwanted modification times
if !config.time_constraints.is_empty() { if !config.time_constraints.is_empty() {
let mut matched = false; let mut matched = false;
if entry_path.is_file() { if let Ok(metadata) = entry_path.metadata() {
if let Ok(metadata) = entry_path.metadata() { if let Ok(modified) = metadata.modified() {
if let Ok(modified) = metadata.modified() { matched = config
matched = config .time_constraints
.time_constraints .iter()
.iter() .all(|tf| tf.applies_to(&modified));
.all(|tf| tf.applies_to(&modified));
}
} }
} }
if !matched { if !matched {