Repository: sharkdp/fd (language: rust)

Issue:
--changed-within/--changed-before not working with directories
Took me a while to figure out… these options work fine when searching files, they don’t currently work when searching directories (thus when `-t d` is given).

Grateful for pointers.

Thanks for this amazing little tool.



Discussion / hints:
Thank you for reporting this!

I hope this could be fixed really easily by removing this condition:
https://github.com/sharkdp/fd/blob/a0505bd4df82dc2203195d4f651a5ab7227987d0/src/walk.rs#L358

I'm not sure why it is there. It could be a copy&paste error from the size-constraints block above (where is_file is actually needed).

Fix patch:
diff --git a/src/walk.rs b/src/walk.rs
index 72101f26e..4050c4346 100644
--- a/src/walk.rs
+++ b/src/walk.rs
@@ -360,14 +360,12 @@ fn spawn_senders(
             // Filter out unwanted modification times
             if !config.time_constraints.is_empty() {
                 let mut matched = false;
-                if entry_path.is_file() {
-                    if let Ok(metadata) = entry_path.metadata() {
-                        if let Ok(modified) = metadata.modified() {
-                            matched = config
-                                .time_constraints
-                                .iter()
-                                .all(|tf| tf.applies_to(&modified));
-                        }
+                if let Ok(metadata) = entry_path.metadata() {
+                    if let Ok(modified) = metadata.modified() {
+                        matched = config
+                            .time_constraints
+                            .iter()
+                            .all(|tf| tf.applies_to(&modified));
                     }
                 }
                 if !matched {


Test patch: