Skip to content

Instantly share code, notes, and snippets.

@kunpengku
Created June 17, 2014 09:18
Show Gist options
  • Save kunpengku/d8dbcc254aba5c91c6eb to your computer and use it in GitHub Desktop.
Save kunpengku/d8dbcc254aba5c91c6eb to your computer and use it in GitHub Desktop.
备份最近一天的文件
#!/bin/bash
BACKUPFILE=backup.$(date +%Y%m%d)
archive=${1:-$BACKUPFILE}
tar cvf - `find -mtime -1 -type f -print` > $archive.tar
# find . -mtime -1 -type f -exec tar rvf "$archive.tar" '{}' \;
gzip $archive.tar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment