Skip to content

Instantly share code, notes, and snippets.

@ziozzang
Created July 2, 2019 00:21
Show Gist options
  • Select an option

  • Save ziozzang/44e1dd6b7b6104c2b506728fa7413bd3 to your computer and use it in GitHub Desktop.

Select an option

Save ziozzang/44e1dd6b7b6104c2b506728fa7413bd3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# ./tar-diff.sh dir_name_here 8
DIR_NAMES=${1:-"asdf"}
DAYS=${2:-"8"}
LASTDATE=`(date --date "${DAYS} days ago" --rfc-3339=seconds)`
TIMESTMP=`date '+%Y-%m-%d'`
tar -cvz --newer-mtime="${LASTDATE}" -f ${DIR_NAMES}-diff-${TIMESTMP}-${DAYS}d.tgz ${DIR_NAMES}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment