From 7ab10c6bbbeeebb9c1fae832e9466b2f1df2f7a1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 10 Aug 2017 15:24:35 +1200 Subject: Explain support for searching for duped files We get this for free from File::Find --- README.markdown | 13 +++++++++++++ checkem | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 1e7c8bc..a44e70d 100644 --- a/README.markdown +++ b/README.markdown @@ -27,6 +27,19 @@ There's a (presently) very basic test suite: Q&A --- +### Can I compare sets of files rather than sets of directories? + +Sure. This uses `File::Find` under the hood, which like classic UNIX `find(1)` +will still apply tests and actions to its initial arguments even if they're not +directories. This means you could do something like this to just look for +duplicate `.iso` files, provided you don't have more than `ARG_MAX`: + + $ checkem ~/media/*.iso + +Or even this, for a `find(1)` that supports the `+` terminator (POSIX): + + $ find ~/media -type f -name \*.iso -exec checkem {} + + ### Why is this faster than just hashing every file? It checks the size of each file first, and only ends up hashing them if they're diff --git a/checkem b/checkem index c105c3e..f64044a 100755 --- a/checkem +++ b/checkem @@ -29,7 +29,7 @@ our $VERSION = 2.9; # If no arguments, work with the current working directory if ( !@ARGV ) { - printf {*STDERR} "%s\n", 'Need at least one dir to search'; + printf {*STDERR} "%s\n", 'Need at least one file or directory'; exit 2; } -- cgit v1.2.3