A simple script to backup the entire directory and subfolders execpt files and path that contain “data” in the string.
Each backup have a unique filenames with the date in it.
#!/bin/bash # Loris Palmerini 2009 - copyright http://www.mozilla.org/MPL/MPL-1.1.html # a simple script to backup the entire didirectory and subfolder # execpt the filename and path that contain "data" # each backup have a unique filenames with the date
# prefix of the filename or beggining part prefix=bck
# the "date" of today in form of YYmmDDhhMMss data=$(date +%Y%m%d%H%M%S) # See date command
# we add the ".tgz" suffix beacouse we will use tar -cvz filename=$prefix$data".tgz" # uncomment the next to print the filename #echo "Backup file filename = $filename"
# list the file of the directory 1 per line and print only #lines without "data" in the name of file or path # You can remove grep command to backup all ls -1 | grep -v "data" > filelist
# creating the backup with the file listed in filenames # as it print backupd files, remove the "v" in -cvzf to make it silenced tar --files-from=filelist -cvzf $filename
# uncomment the next if You want to close the shell #exit 0