• Welcome to Web Hosting Community Forum for Webmasters - Web hosting Forum.
 

Recommended Providers

Fully Managed WordPress Hosting
lc_banner_leadgen_3
Fully Managed WordPress Hosting

WordPress Theme

Divi WordPress Theme
WPZOOM

Forum Membership

Forum Membership

Delete old backup folders from Linux server

Started by Web_news, June 14, 2013, 12:57:24 PM

Web_news

Hi,

I am taking my Linux server's backup via script. The script is executed via cron on every week. However it is filling my disk space on the server and I am deleting the old backups manually. Is there any way I can delete more than 30days old backups automatically?

Thanks,

Kailash

#1
Certainly it is possible to delete old backups. You can use the following command in your backup script to delete 30 days old folders:

for i in `find /home/mydirectory/ -maxdepth 1 -type d -mtime +30 -print`; do echo -e "Deleting directory $i";rm -rf $i; done

For more details, please refer http://blog.webhostingdiscussion.net/linux-commands/delete-all-directories-x-days-old.htm

- Kailash

Web_news

Thanks for the command. I will test it and will include it in my back script.

Thanks!