Thursday, October 27, 2011

[Level 1] Backup directories by cpio.

#!/bin/bash
source=$1
target=$2
(cd $source; find . -print | cpio -ocv) | (cd $target; cpio -icuvd)
# cd $source; find . -print | cpio -ocv > /tmp/tmp.cpio
# cd $target; cpio -icuvd < /tmp/tmp.cpio
Wish this helps.
regards,
Stanley Huang