find folder size ----- > du -sh <folder-name>
find file ----- > $ find /usr/local -type f -name xxx.txt
files modified between now and 1 day ago --> find /var/... -mtime 0
find files modified less than 1 day ago --> find /var/... -mtime -1
find files modified between 24 and 48 hours ago --> find /var/... -mtime 1
find files modified more than 48 hours ago --> find /var/... -mtime +1
delete svn ----> rm -rf `find . -type d -name .svn`
It will find all backups older than 30 days and delete them.
0 3 * * * find $HOME/db_backups -name "db_name*.sql" -mtime +30 -exec rm {} \; >> $HOME/db_backups/purge.log 2>&1
Older than 30 days :
find /path-to-file/ -name "test-*".tar.gz -mtime +30 -exec rm {} \;
find /path-to-file/ -name "test_*".sql -mtime +30 -exec rm {} \;
Files older than 25days : find /path-to-file/ -name "test-*".tar.gz -mtime +25;
Find and copy : find /path-to-file/xxx-* -mtime +30 -exec cp {} /path-to-file \;
find file ----- > $ find /usr/local -type f -name xxx.txt
files modified between now and 1 day ago --> find /var/... -mtime 0
find files modified less than 1 day ago --> find /var/... -mtime -1
find files modified between 24 and 48 hours ago --> find /var/... -mtime 1
find files modified more than 48 hours ago --> find /var/... -mtime +1
delete svn ----> rm -rf `find . -type d -name .svn`
It will find all backups older than 30 days and delete them.
0 3 * * * find $HOME/db_backups -name "db_name*.sql" -mtime +30 -exec rm {} \; >> $HOME/db_backups/purge.log 2>&1
Older than 30 days :
find /path-to-file/ -name "test-*".tar.gz -mtime +30 -exec rm {} \;
find /path-to-file/ -name "test_*".sql -mtime +30 -exec rm {} \;
Files older than 25days : find /path-to-file/ -name "test-*".tar.gz -mtime +25;
Find and copy : find /path-to-file/xxx-* -mtime +30 -exec cp {} /path-to-file \;
No comments:
Post a Comment