Here is a BASH Script which will back up the files created in the current directory within the past 24 hours in a “.tar.gz” file. Bash, an acronym for Bourne-again Shell, is a Unix shell written for the GNU Project and is the default shell for Linux and Mac OS X. let you accomplish a group of tasks quickly and without much intervention from the user like batch files in Windows.
#!/bin/bash
FILEBACKUP=backup-$(date +%m-%d-%Y)
incrback=${1:-$ FILEBACKUP}
tar cvf—`find . -mtime -1 -type f -print` >
$incrback.tar
gzip $incrback.tar
echo “The directory $PWD has been
backed up in archive file
\”$incrback.tar.gz\”.”
Line 2 of this script embeds the date in the backup filename. Line 3 introduces the string variable incrback as the filename of the archive. Line 4 tar condenses the current directory into a single tar file, while the fifth line gzip compresses the resultant tar file to the final tar.gz output file. The last line prints to the console that the current directory has been backed up to the archive file.
Work files backup is extremely vital as it safeguards not only the recent data you have worked on but also important client info that one can’t afford to lose
There are many important files that schools have that need to be kept safely. To do so, these documents must have a backup just in case the other copies are lost.