Copy and encrypt

March 11th, 2007

#!/bin/bash # # backupandencrypt.sh # # Syntax: backupandencrypt.sh SOURCE TARGET KEYFILE # SOURCE the source directory (the directory to backup) # TARGET the target directory (the directory to backup to) # KEYFILE the file containing thek key to use for encryption ################################################################ ORIGDIR="$1" DESTDIR="$2" KEYFILE="$3" # [Removed] check that all parameters are present for i in $ORIGDIR*; do if [ ! -f "$DESTDIR$(basename "$i").cpt" ]; then echo copying: $i cp "$ORIGDIR$i" $DESTDIR ccencrypt -k $KEYFILE "$DESTDIR/$(basename "$i")" fi done Mijn eerste bash scriptje :-) Ter ondersteuning van het backup project.

Leave a Reply