Re: [PATCH 2/4] hardlink: add --list-duplicates and --zero
Karel Zak <[email protected]>
| Newsgroups | org.kernel.vger.util-linux |
|---|---|
| Message-ID | <ivgbtqt2qjlpzxgh6tkdapfohjwu677heddtn7cpkpaqjyoi6g@brl4uxsj6lsv> |
On Mon, Oct 28, 2024 at 07:19:30PM GMT, наб wrote:
> --list-duplicates codifies what everyone keeps re-implementing with
> find -exec b2sum or src:perforate's finddup or whatever.
>
> hardlink already knows this, so make the data available thusly,
> in a format well-suited for pipeline processing
> (fixed-width key for uniq/cut/&c.,
> tab delimiter for cut &a.,
> -z for correct filename handling).
Why do we need a 16-byte discriminator? The list consists of absolute
paths, so it should be unique enough. This seems like an unusual
thing, as I cannot recall any other tool that uses something like
this.
> +*-l*, *--list-duplicates*::
> +Don't link anything, but list the absolute path of every duplicate file, one per line, preceded by a unique 16-byte discriminator and a tab.
...
> + printf("%016zu\t%s%c", (size_t)other, l->path, opts.line_delim);
Karel
--
Karel Zak <[email protected]>
http://karelzak.blogspot.com