Copies SOURCE to DEST, while displaying progress and writing an MD5sum to SOURCE.md5.
Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE.txt
README.md
progress-md5-copy

README.md

progress-md5-copy

Usage: progress-md5-copy SOURCE [DEST]

Copies SOURCE to DEST, while displaying progress and writing an MD5sum to SOURCE.md5.

SOURCE must be a regular file.

DEST can be a directory or a filename. (Defaults to current directory.)

If SOURCE.md5 exists then it is checked against SOURCE instead of creating a new checksum.

The script uses the tee command to compute the MD5sum while performing the copy at the same time. SOURCE is only read once. (Good for giant files.)

Requirements

Should work on any Unix system. Requires the commands pv and md5sum.

Install

$ mkdir -p ~/bin
$ cd ~/bin
$ wget https://raw.github.com/bkidwell/progress-md5-copy/master/progress-md5-copy
$ chmod +x progress-md5-copy

Example Usage

Suppose you want to copy a virtual machine from one host to another via a thumbdrive.

On the source machine, you would mount the thumbdrive and then do:

$ ~/bin/progress-md5-copy ~/Transfer/important-vm.tar.gz /media/thumbdrive
Copying               ~/Transfer/important-vm.tar.gz
to                    /media/thumbdrive/important-vm.tar.gz
and creating          /media/thumbdrive/important-vm.tar.gz.md5

  3GB 0:00:30 [ 100MB/s] [===================================>] 100%

Checking              /media/thumbdrive/important-vm.tar.gz
against               /media/thumbdrive/important-vm.tar.gz.md5
Type CTRL-C to abort verification step.

  3GB 0:00:30 [ 100MB/s] [===================================>] 100%            
-: OK

Unmount the thumbdrive, move to the destination machine and mount it there. Then:

$ ~/bin/progress-md5-copy /media/thumbdrive/important-vm.tar.gz ~/Transfer
Copying               /media/thumbdrive/important-vm.tar.gz
to                    ~/Transfer/important-vm.tar.gz
and checking against  /media/thumbdrive/important-vm.tar.gz.md5

  3GB 0:00:30 [ 100MB/s] [===================================>] 100%
-: OK

Checking              ~/Transfer/important-vm.tar.gz
against               ~/Transfer/important-vm.tar.gz.md5
Type CTRL-C to abort verification step.

  3GB 0:00:30 [ 100MB/s] [===================================>] 100%
-: OK

If the checksum didn't match, the last line would say something other than OK.