Skip to content

Instantly share code, notes, and snippets.

@idserda
Created October 30, 2014 19:54
Show Gist options
  • Save idserda/4184f5db4fb2f1878a48 to your computer and use it in GitHub Desktop.
Save idserda/4184f5db4fb2f1878a48 to your computer and use it in GitHub Desktop.
Simple bash script for Mac OS X to copy data from removable media (sd card) to file, with progres information
#!/bin/bash
NUMARGS=2
if [ $# -ne $NUMARGS ]
then
echo "Usage: `basename $0` <file.img> </dev/diskN>"
exit
fi
DEVICE="$2"
IMAGE="$1"
diskutil unmountDisk $DEVICE
dd if=$DEVICE bs=1m | pv -ptre $DEVICE | dd of=$IMAGE bs=1m
diskutil eject $DEVICE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment