Created
April 22, 2013 00:34
-
-
Save achalddave/5431736 to your computer and use it in GitHub Desktop.
Naive Bash Backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRCDIR=src | |
DSTDIR=dst | |
# copy recursively (-r) updated (-u) files, preserve (-p) attributes if | |
# possible | |
$(echo "cp -R -u -p $SRCDIR/* $DSTDIR") | |
# hack? psh | |
for file in $(find $DSTDIR/*) ; do | |
[ ! -e "$SRCDIR/${file#*/}" ] && echo "Removing $file" && rm $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment