The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Linux command for deleting files after x number of days
Hello.
I'm using a .php script that automatically performs a full cPanel backup via cron job. Space will become an issue real quick with these daily backups dumping into my root. I'm not using the ftp option to move them elsewhere at this time. I would like to set up a cron job in cPanel to automatically delete all cPanel backups that are 3 days old or older. Is this the correct command to do so or am I completely off base? If so, what is the correct command to work on cPanel 11 over Linux? find /home/user/backup-* -mtime +3 -exec rm {}\; The typical full backup reads like this /home/user/backup-2.4.2009_18-11-01_user.tar.gz I'm assuming the backup-* wildcard is correct usage as well. Thanks. |
#2
|
||||
|
||||
This is a line from my DB backup cron:
Code:
find /home/default/backups -name 'db*' -type f -ctime +6 -delete; |
#3
|
|||
|
|||
I have a question about the second argument in the command line. -name 'db*'
I want this cron job to delete only e.g. /home/user/backup-2.4.2009_18-11-01_user.tar.gz files How does the argument -name 'db*' removed those tar.gz files? I'm asking because I'm a novice with Linux command not because I'm challenging your method. Thanks. |
#4
|
||||
|
||||
That line is from my own cronjob. My DB backups are in the form db-2009-01-31, and my data ones data-2009-01-31. You probably want something like:
Code:
find /home/user -name 'backup*' -type f -ctime +6 -delete; |
#5
|
|||
|
|||
Looks like that's going to work. Thanks for your help.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|