Best way to continue stopped move (mv) by merging directories

command linefile-copyrename

I have moved (mv) a pretty large directory on my NAS (Linux based), but had to interrupt the procedure. Not being a regular Linux user, I though I could just continue and merge the rest later in.

mv /oldisk/a /newdisk

Procedure is halfway done, so rest of /oldisk/a still exists, and /newdisk/a with the already copied files is already present. I have no idea which files have been already copied. BTW, under /oldisk/a, of course, are plenty of sub directories.

What would be the best way to move / merge the remaining files to /newdisk/a ?

Best Answer

rsync --verbose --archive --dry-run /oldisk/a/ /newdisk/a/

The --dry-run (or -n) will do a dry run, showing you what it would do without actually doing anything.

If it looks ok, run the rsync without the -n option.

This will be a copy, not a move, which isn't quite what you're doing, but is safer. The --archive (or -a) ensures all the ownership and timestamps metadata is preserved (which a regular copy would not).

Related Question