My Journal



Backup for One day old files

This should be verified as I may have inadvertently introduced a bug while I was ‘scrubbing’ this. I’m recycling some of my tricks/scripts/configs in the off chance that they are of use to someone besides me. For this one I needed a quick shell script to create a tar.gz backup file of anything modified or added since 1 day ago and cobbled this together to address the concept of ‘incremental’ backup capability.

#-- ---------------------------------------------------- --# 
#-- Desc..: backup script for any file 1 day old (assumes 
#-- this is run in a scheduled job such as cron) 
#-- Author: john.lawson@scriobha.im 
#-- Date..: 03.18.2015 
#-- Notes.: 
#-- ---------------------------------------------------- --# 
#-- Configuration and initialization of values ------------# 
DATEFORMAT=`date "+%F_%H-%M-%S"` 
#-- -------------------------------------------------------# 

echo '#---- Begin SiteDataBackup -------' 

`find ${SOURCEDIR}/ -path ${SOURCEDIR}/[do not include] -prune -o -path ${SOURCEDIR}/[do not include2] -prune -o -newerct '1 day ago' -type f -print | xargs tar --null -zcpf $BACKUPFILENAME`

Leave A Comment