#! /bin/bash output_size=`du -m "$2" | cut -f 1` if [[ $output_size = "" ]] then output_size=0 fi dd bs=1m seek=$output_size skip=$output_size if="$1" of="$2"
Friday, August 3, 2012
Incremental/interruptable Unix/OSX file copy
I wanted to copy a large file to a Unix (OSX) system, and I knew it wouldn't complete before I took my laptop home. Indeed, it would take a couple of days, so a couple of detaches would be needed. I couldn't find anything that seemed to do the job I wanted, so I wrote the following script. It takes two arguments: the from file and the to file. It examines how large the to file is, and starts the copy from there, using 1 megabyte blocks. It won't work if the file changes during the overall copy operation of course.
No comments:
Post a Comment