Main.ProjectBackupScript


This simple backup script uses GNU tar to archive a directory, and gzip to compress this archive. The current system date is used for the archive name.

For some extra details that may shed light on various notices these tools may print out, see http://www.gnu.org/software/tar/manual/html_node/absolute.html#SEC113.

#!/bin/sh

#========================================================
# Backup script for any project
#========================================================
# Please customize this script for your own usage by
# changing the filenames and paths below to suit your needs.
# In particular, you want to change the PROJECTNAME
# below to the name of your project eg:
#    PROJECTNAME=UniversityReport2014
#========================================================

# Edit your project name here:
PROJECTNAME=MyProject

#========================================================
# Caution - Don't edit anything below here unless 
# you understand UNIX shell scripts.
#========================================================
echo "Backing up $PROJECTNAME..."
echo "Creating backup directory based on current time..."

DATEPATH=Older/`date +%Y_%m_%d_%Hh%Mm%S`
mkdir $DATEPATH
echo "Copying files..."
echo $DATEPATH

#COPY OPTION:
#==============================
#cp -r Current/* $DATEPATH
#==============================


#COMPRESS OPTION:
#==============================
echo "Packing..."
tar -cf $DATEPATH/$PROJECTNAME.tar Current/*
echo "Compressing..."
gzip $DATEPATH/$PROJECTNAME.tar
#==============================

echo "Done. Backup Complete."