0

I would like to backup all files older than 90 days and greater plus gzip them. I could execute:

find /path/to/files -type f -mtime 90 -exec gzip "{}" \;

Problem with this command is it includes files 90 days old and not older ones. So it will gzip June's files but not May's. Thanks!

0

3 Answers 3

2

-mtime +90 should do the trick.

0
2

for exactly 90 it should be -mtim +89

2

From man find

+n     for greater than n,
-n     for less than n,
 n      for exactly n.

-mtime n
    File's data was last modified n*24 hours ago.  See the comments for -atime to understand how rounding affects the interpretation of file modification times.

So the correct line to backup files modified more than 90 days ago, will be

$ find /path/to/files -type f -mtime +90 -exec gzip {} +
1
  • The man page I was using did not include that info. Thanks for the reference!
    – nizbit
    Aug 31, 2015 at 20:40

Not the answer you're looking for? Browse other questions tagged .