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.
 


Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
6,109
Reaction score
5,095
Credits
38,660
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
 
OP
G

Gabriel9999

Member
Joined
Mar 12, 2019
Messages
38
Reaction score
4
Credits
130
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
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,704
Reaction score
2,471
Credits
13,677
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.
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Staff online

Members online


Top