On Sun, Jun 28, 2015 at 4:27 PM, Chris Bennett
<chrisbenn...@bennettconstruction.us> wrote:
> On Mon, Jun 29, 2015 at 12:56:04AM +0200, nerv wrote:
>> On Sun, 28 Jun 2015 17:39:18 -0500
>> Chris Bennett <chrisbenn...@bennettconstruction.us> wrote:
>>
>> > I had 4 different hardrives that were failing.
>> > I bought a 2TB usb drive to back up all the home folders.
>> >
>> > I now would like to cp all of the folders and files to another empty
>> > partition.
>> >
>> > But I don't want to overwrite any files with same name but different
>> > content.
>> >
>> > For example:
>> >
>> > /homeX/index.html to /homePerfect
>> > /homeY/index.html to /homePerfect
>> >
>> > both have same name but different contents.
>> >
>> > I googled but couldn't find any solutions.
>> > Ideally I would like a list of failed file copies.
>> >
>> > Any ideas or scripts or ports?
>> > Browsing through 4 home folders is a nightmare.
>> >
>> > Chris Bennett
>> >
>>
>> If you can't find a switch for cp you may have an easier time using
>> rsync, but I'm not too familiar with it so I couldn't tell you
>> what switches to use (It may be able to natively do what you're asking
>> however).
>> Writing a script for it using cp should be quite easy, for each of the
>> partition have the script recursively go into all folders and copy the
>> files after verifying if the name already exists in the target
>> partition. If it does, compare checksums,
>> same checksum : do nothing and go to the next file,
>> different checksum : copy and append a number to its name (or append to
>> it a name for the source partition).
>
> I looked at rsync and cp and gnu cp.
> noclobber just won't do what I want.
>
> Using checksums seems like a good part of the answer, but name changing
> would be very complicated. I have everything read-only except for
> regular /home, /var, / and /tmp. I do some of my programming in /home
> folder and I also have many html files. I already wrote software to
> change file contents to new values, but that adds even more
> complications for both of those areas.
>
> And I want to do this for 4 home folders!!???

IMO, you're over thinking it.

Step 1) GET THE DATA OFF THE FAILING DRIVES.  Doing *anything* before
that's done means you *want* to lose data.

Step 2) okay, *now* that the data is safe, compare files between trees
and delete duplicates

Note that trying to dedup as it's copied will probably *increase* the
number of times the data has to be read and thus increase the chance
of lost data.


Philip Guenther

Reply via email to