I am trying to come up with the safest way to move data between two drives, designed to handle the worst possible circumstances. For example: if you were trying to move the only existing copies of pictures of your child being born while a crazed monkey was roaming the halls and might pull the power cord on your Mac and/or the external drives at any moment.
Note that there is a similar question for syncing, but I'm asking specifically about moving which is a different problem, because (amongst other reasons) you have to be able to tell which files have been moved and which have not. You also need to account for the possibility that some files might have been copied to the intended destination but not removed from the source.
This solution does not have to use the GUI. In fact I find the Terminal comforting. I don't mind installing new programs (especially if available via brew
). Only requirement is that the solution be compatible with Mac OS X 10.8.
Here is the work-flow solution that I have in mind:
cp
(copy) files (if needed)- checksum files (either after copy or if an existing copy of the file is found)
- Move original file to trash (not
rm
!) after a file has been moved to new location
More specifically:
User specifies where files should be moved to (target/destination folder). Call it
$DEST
(This would be similar to the--target-directory
flag to GNUmv
User specifies files/folders which should be moved to
$DEST
. Call that$INPUT
Script would then look for each file/folder from
$INPUT
on$DEST
.If file/folder is found on
$DEST
then checksum it against$INPUT
copy.If checksum matches, move
$INPUT
copy to trash.If checksum does not match, replace
$DEST
copy with$INPUT
Note: while I do care about permissions (technically I care about "executability"), I do not care about "ownership" as I am the only user of this local system.
Before I go and re-invent the wheel, does something like this already exist?
Basically I want as much assurance as possible that a good copy has been made before I delete the original, without doing a full sync between the two drives.