Overwriting old/corrupted files in a backup

Linux for blind general discussion blinux-list at redhat.com
Mon Aug 14 18:44:48 UTC 2017

Okay, so using the cp command with the -Rn switch is convenient for
say copying my Music folder from my home directory to an external hard
drive or the SD card for my portable Media player when the destination
already has an older copy without needing to copy everything already
present in the old copy, manually determining what's been added and
copying manually, or dealing with a bunch of prompts. It also allows
an aborted copy to more or less be resumed from where it left off.

This method is simple enough to not require scripting or complex
command syntax, but it does have a few downsides:
1. It won't overwrite corrupted files left by an interrupted copy, and
such files are too rare for manual searching.
2. Files that have been altered don't get copied. unless they've
changed filename. Not a big issue for copying my Music folder since
those files are seldom altered, but copying say, my writing folder can
lead to the backup media containing only older drafts of some
3. It tells me nothing of files from an older copy that have been
deletd/renamed since the last copy. jdupes can find old files on the
destination media if the new file is just a rename, but it can't help
with files that have been altered as well as renamed.

I suppose what I'm looking for is a command line utility or script
that executes the following pseudo code:
Given directories source and destination:
for every file found in both source and destination:
if file.source != file.destination
prompt user whether to overwrite one version of the file with the
other or to add the files to a list for later examination.
For every file only in source:
search for match in destination.
If match found prompt user towhich to rename to match.
If not match found, copy to destination.
For every file only in destination:
search for match in source.
If match is found, prompt user to which file should be renamed.
If no match is found, prompt user whether to copy of delete.

If anyone knows of command line utilities to help with this task, it
would be greatly appreciated.

More information about the Blinux-list mailing list