Remove older backups like 1 month

Gabriel9999

Member
Joined
Mar 12, 2019
Messages
38
Reaction score
4
Credits
130
I have some backup files which are created in a Daily manner. After some time they take a lot of space and i want to delete them according to their time stamp like delete 1 month olders. Thanks.
 


G'day Gabriel, and Welcome to linux.org

What was used to make these backups?

Where are they stored ?.....same hard drive as the OS?...or an external hard drive ?

Which OS are you running?....which desktop etc
 
G'day Gabriel, and Welcome to linux.org

What was used to make these backups?

Where are they stored ?.....same hard drive as the OS?...or an external hard drive ?

Which OS are you running?....which desktop etc


Hi,
Same hard drive as the OS
Only for files stored in linux
 
Find command is very useful option here. You can search for files older then 1 month and delete them with -delete option.
$ find /tmp -mtime +7 -type f -name '*.tmp' -delete
A very good suggestion, but the example you have posted finds and deletes files that were modified more than 7 days ago.

For the OP to find and delete backup files that were modified over a month ago they would need to use +30 for the -mtime option.
 

Members online


Top