Re: Tool to compare directories and delete duplicate files from one directory
Date: Thu, 04 May 2023 21:56:04 UTC
On 5/4/23 18:02, Ireneusz Pluta/wp.pl wrote: > W dniu 4.05.2023 o 17:53, Kaya Saman pisze: >> >> Even if I create some kind of shell script and use diff, I think it >> will only compare names and not file sizes. > > use cmp(1) > This is interesting! From the man page I can see: Compare file sizes of example.txt and /boot/loader.conf and return 1 if they are not equal. Note that -z can only be used with regular files: $ cmp -z example.txt /boot/loader.conf example.txt /boot/loader.conf differ: size But*, what happens when you have thousands of files? The man page at the top suggests compare file1 and file2, not dir1 and dir2 which is what I am looking for: NAME cmp – compare two files SYNOPSIS cmp [-l | -s | -x] [-bhz] [--ignore-initial=num1[:num2]] [--bytes=num] file1 file2 [skip1 [skip2]] If it did that I would definitely say it's what I'm looking for. I need to compare the files within: /dir /dir_1 /dir_2 /dir_3 where /dir_(x) are directories that have been merged into /dir....