Skip to main content
added 301 characters in body
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

If the files are not modified after initial creation, you could delete if they have not been modified in over 90 days:

find /path/to/folder ! -type d -mtime +90 -delete

or

find /path/to/folder ! -type d -mtime +90 -exec rm -f {} +

(for versions of find which do not support the -delete action).

As a matter of safety, you should use a non-destructive version of this command first and ensure it will delete exactly what you want deleted, especially if you intend to automate this action via cron or similar, e.g.:

find /path/to/folder ! -type d -mtime +90 -print

Note that -mtime +90 checks the modification time of the files and returns true if the age, rounded down to an integer number of days (86400 second units) is strictly greater than 90, so matches on files that have been last-modified 91 days ago or earlier.

If the files are not modified after initial creation, you could delete if they have not been modified in over 90 days:

find /path/to/folder -mtime +90 -delete

or

find /path/to/folder -mtime +90 -exec rm {} +

(for versions of find which do not support the -delete action).

As a matter of safety, you should use a non-destructive version of this command first and ensure it will delete exactly what you want deleted, especially if you intend to automate this action via cron or similar, e.g.:

find /path/to/folder -mtime +90 -print

If the files are not modified after initial creation, you could delete if they have not been modified in over 90 days:

find /path/to/folder ! -type d -mtime +90 -delete

or

find /path/to/folder ! -type d -mtime +90 -exec rm -f {} +

(for versions of find which do not support the -delete action).

As a matter of safety, you should use a non-destructive version of this command first and ensure it will delete exactly what you want deleted, especially if you intend to automate this action via cron or similar, e.g.:

find /path/to/folder ! -type d -mtime +90 -print

Note that -mtime +90 checks the modification time of the files and returns true if the age, rounded down to an integer number of days (86400 second units) is strictly greater than 90, so matches on files that have been last-modified 91 days ago or earlier.

added 130 characters in body
Source Link
user4556274
  • 9.4k
  • 2
  • 35
  • 38

If the files are not modified after initial creation, you could delete if they have not been modified in over 90 days:

find /path/to/folder -mtime +90 -delete

or

find /path/to/folder -mtime +90 -exec rm {} +

(for versions of find which do not support the -delete action).

As a matter of safety, you should use a non-destructive version of this command first and ensure it will delete exactly what you want deleted, especially if you intend to automate this action via cron or similar, e.g.:

find /path/to/folder -mtime +90 -print

If the files are not modified after initial creation, you could delete if they have not been modified in over 90 days:

find /path/to/folder -mtime +90 -delete

As a matter of safety, you should use a non-destructive version of this command first and ensure it will delete exactly what you want deleted, especially if you intend to automate this action via cron or similar, e.g.:

find /path/to/folder -mtime +90 -print

If the files are not modified after initial creation, you could delete if they have not been modified in over 90 days:

find /path/to/folder -mtime +90 -delete

or

find /path/to/folder -mtime +90 -exec rm {} +

(for versions of find which do not support the -delete action).

As a matter of safety, you should use a non-destructive version of this command first and ensure it will delete exactly what you want deleted, especially if you intend to automate this action via cron or similar, e.g.:

find /path/to/folder -mtime +90 -print
Source Link
user4556274
  • 9.4k
  • 2
  • 35
  • 38

If the files are not modified after initial creation, you could delete if they have not been modified in over 90 days:

find /path/to/folder -mtime +90 -delete

As a matter of safety, you should use a non-destructive version of this command first and ensure it will delete exactly what you want deleted, especially if you intend to automate this action via cron or similar, e.g.:

find /path/to/folder -mtime +90 -print