aboutsummaryrefslogtreecommitdiff
path: root/src/filecounter.rs
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-07-06 10:25:41 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2023-07-06 10:25:41 +0200
commit7aad1e8f5ecdef2bd8317a538350d43ba00d048d (patch)
treee20c36bdf3cf3adff6ea61f9e9d3301bb8c22838 /src/filecounter.rs
parent851f175eb33a77f6442b2843194d7ad30e4e1f1c (diff)
add filecounter
Diffstat (limited to 'src/filecounter.rs')
-rw-r--r--src/filecounter.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/filecounter.rs b/src/filecounter.rs
new file mode 100644
index 0000000..1ed58e3
--- /dev/null
+++ b/src/filecounter.rs
@@ -0,0 +1,10 @@
+use walkdir::*;
+
+pub fn filecount(path : &str) -> u64 {
+ let mut counter : u64 = 0;
+ for _ in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) {
+ counter += 1;
+ }
+
+ counter
+}