How to remove files Older Then “n” days


This command will remove all files which older than 365 days.  Be careful when you need to run this command. Before add "rm" use "ls"  option to see that  files..

  • List all files older than 365 days.
#find /pathtofile -type f -mtime +365 -prune | xargs ls  -ld

For  Linux  also;

#find /tmp -atime +365
  • Remove all files older than 365 days.
#find /pathtofile -type f -mtime +365 -prune | xargs rm –r 

 

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

200 Total Posts
Follow Me

Related Post

2 Comments

  1. dsfdsf

  2. In fact when someone doesn't understand afterward its up to other visitors that they will assist, so here it takes place.

Leave a Reply