bash-stuff/backup-image/move.sh

26 lines
693 B
Bash
Executable File

#!/bin/bash
echo "Move Backup!";
if [ $# -eq 0 ]; then
echo "Usage: move.sh <Backup disk name> <Backup disk new name> [Storage disk root path]";
exit 2;
fi
ssrc="";
if [ -z $3 ]; then
ssrc="/mnt";
else
ssrc="$3";
fi
echo "Source Backup disk name: $1";
echo "Target Backup disk name: $2";
echo "Storage disk root path: $ssrc";
echo "Press Enter to Start...";
read;
echo "Moving...";
mv -f "$ssrc/hsums/$1-gz.hash" "$ssrc/hsums/$2-gz.hash";
mv -f "$ssrc/hsums/$1-tbl.hash" "$ssrc/hsums/$2-tbl.hash";
mv -f "$ssrc/hsums/$1.hash" "$ssrc/hsums/$2.hash";
mv -f "$ssrc/parts/$1.part.gz" "$ssrc/parts/$2.part.gz";
mv -f "$ssrc/tabls/$1.tbl" "$ssrc/tabls/$2.tbl";
echo "Finished!";
exit 0;