Fast file counting and listing for spinning rust, in rust.
ffcnt's purpose is to provide a faster alternatives to some common filesystem operations as a frontend for the platter-walk crate.
ffcnt --type f
replaces find -type f | wc -l
ffcnt --type f --ls --leaf-order content
replaces find -type f
and returns files in optimized order for reading
ffcnt -s
replaces du -s --apparent-size
fiemap
ioctl on directories.find
.You can test filesystem support with the filefrag
tool.
```
$ filefrag /tmp/ /tmp/: 3 extents found
$ filefrag /mnt/test/ /mnt/test/: FIBMAP unsupported ```
You can find prebuilt x86_64-linux-glibc binaries without debug information under releases. For troubleshooting and other environments you'll have to build your own.
cargo build --release
``` ffcnt [FLAGS] [OPTIONS] [dirs]...
FLAGS: -h, --help Prints help information --ls list files -s sum apparent length of matched files. Implies --leaf-order inode. -V, --version Prints version information
OPTIONS:
--leaf-order
ARGS:
Idle system:
```
196608
real 0m23.889s user 0m1.233s sys 0m2.127s
196608
real 2m31.562s user 0m0.557s sys 0m3.860s ```
Busy system with mixed read/write workload. Differences in file counts arose due to writes happening in the meantime:
```
4411262
real 10m36.288s user 0m3.656s sys 0m7.588s
4412101
real 45m54.955s user 0m3.212s sys 0m12.044s ```
Both tests were performed on HDDs and the files were spread over 65536 directories with a nesting depth of 2, i.e. a branching factor of 256.