Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 May 2023 16:53:10 +0100
From:      Kaya Saman <kayasaman@optiplex-networks.com>
To:        freebsd-questions@freebsd.org
Subject:   Tool to compare directories and delete duplicate files from one directory
Message-ID:  <9887a438-95e7-87cc-a162-4ad7a70d744f@optiplex-networks.com>

next in thread | raw e-mail | index | archive | help
Hi,


I'm wondering if anyone knows of a tool like diff or so that can also 
delete files based on name and size from either left/right or 
source/destination directory?


Basically what I have done is performed an rsync without using the 
--remove-source-files option onto a newly bought and created disk pool 
(yes zpool) that i am trying to consolidate my data - as it's currently 
spread out over multiple pools with the same folder name.


The issue I am facing mainly is that I perform another rsync and use the 
--remove-source-files option, rsync will delete files based on name 
while there are some files that have the same name but not same size and 
I would like to retain these files.


Right now I have looked at many different options in both rsync and 
other tools but found nothing suitable. I even tested using a few test 
dirs and files that I put into /tmp and whatever I tried, the files of 
different size either got transferred or deleted.


How would be a good way to approach this problem?


Even if I create some kind of shell script and use diff, I think it will 
only compare names and not file sizes.


I'm really lost here....


Regards,


Kaya





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9887a438-95e7-87cc-a162-4ad7a70d744f>