Jump to content

Delete files that are 30 days old

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Pan

Pan

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
The backup software we use is storing files in a directory and doesn't delete them. I need to delete all files that are older than 30 days. Is this possible?

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
You can add a command to the CRONTAB that will delete files that are older than 30 days. Here is the command:


find <YOUR Fully qualified path to DIR> -mtime +30 -exec rm {} \;


The +30 specifies the amount of days. Change "<YOUR Fully qualified path to DIR>" to the directory you want to delete files from.

#3
Pan

Pan

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
What is a fully qualified path? I've heard that with domain names but never dirs!

#4
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
The full-path, e.g. /home/user/some/directory