NAME App::UniqFiles - Report or omit duplicate file contents VERSION This document describes version 0.131 of App::UniqFiles (from Perl distribution App-UniqFiles), released on 2020-05-28. SYNOPSIS # See uniq-files script NOTES FUNCTIONS uniq_files Usage: uniq_files(%args) -> [status, msg, payload, meta] Report or omit duplicate file contents. Given a list of filenames, will check each file size and content for duplicate content. Interface is a bit like the "uniq" Unix command-line program. This function is not exported by default, but exportable. Arguments ('*' denotes required arguments): * algorithm => *str* What algorithm is used to compute the digest of the content. The default is to use "md5". Some algorithms supported include "crc32", "sha1", "sha256", as well as "Digest" to use Perl Digest which supports a lot of other algorithms, e.g. "SHA-1", "BLAKE2b". If set to '', 'none', or 'size', then digest will be set to file size. This means uniqueness will be determined solely from file size. This can be quicker but will generate a false positive when two files of the same size are deemed as duplicate even though their content may be different. * count => *bool* (default: 0) Whether to return each file content's number of occurence. 1 means the file content is only encountered once (unique), 2 means there is one duplicate, and so on. * digest_args => *array* Some Digest algorithms require arguments, you can pass them here. * files* => *array[str]* * group_by_digest => *bool* Sort files by its digest (or size, if not computing digest), separate each different digest. * recurse => *bool* If set to true, will recurse into subdirectories. * report_duplicate => *int* (default: 2) Whether to return duplicate items. Can be set to either 0, 1, 2. If set to 2 (the default), will only return the first of duplicate items. For example: "file1" contains text 'a', "file2" 'b', "file3" 'a'. Only "file1" will be returned because "file2" is unique and "file3" contains 'a' (already represented by "file1"). If set to 1, will return all the the duplicate files. From the above example: "file1" and "file3" will be returned. If set to 3, will return all but the first of duplicate items. From the above example: "file3" will be returned. This is useful if you want to keep only one copy of the duplicate content. You can use the output of this routine to "mv" or "rm". If set to 0, duplicate items will not be returned. * report_unique => *bool* (default: 1) Whether to return unique items. * show_digest => *bool* Show the digest value (or the size, if not computing digest) for each file. Note that this routine does not compute digest for files which have unique sizes, so they will show up as empty. * show_size => *bool* Show the size for each file. Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information. Return value: (any) HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. SEE ALSO find-duplicate-filenames from App::FindUtils move-duplicate-files-to from App::DuplicateFilesUtils, which is basically a shortcut for "uniq-files -D -R . | while read f; do mv "$f" SOMEDIR/; done". AUTHOR perlancar COPYRIGHT AND LICENSE This software is copyright (c) 2020, 2019, 2017, 2015, 2014, 2012, 2011 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.