Apr 4, 2005 #1 inunix Technical User Jul 30, 2002 53 US Hi Can someone provide a script to delete files and directories older than "n" days. Many thanks.
Apr 4, 2005 #2 PHV MIS Nov 8, 2002 53,708 FR man find Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
man find Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Apr 4, 2005 #3 sandeepmur Programmer Dec 14, 2003 295 PT Try this.. got this from an earlier post #### MOVING OLD files BEFORE A CERTAIN DATE_TIME ######## touch 200503261800 /home/etbc01/temp/tempdate.txt // creates a reference date_Time file. In this case it is 26th of MArch, 2005 at 1800 hrs. mv `find . ! -newer /home/temp/tempdate.txt -type f` /home/temp/ ofcourse u can delete them if u want to.. Hope this helps.. Upvote 0 Downvote
Try this.. got this from an earlier post #### MOVING OLD files BEFORE A CERTAIN DATE_TIME ######## touch 200503261800 /home/etbc01/temp/tempdate.txt // creates a reference date_Time file. In this case it is 26th of MArch, 2005 at 1800 hrs. mv `find . ! -newer /home/temp/tempdate.txt -type f` /home/temp/ ofcourse u can delete them if u want to.. Hope this helps..
Apr 4, 2005 1 #4 KenCunningham Technical User Mar 20, 2001 8,475 GB You can also use -mtime +n if you're not too worried about exact times of creation. Upvote 0 Downvote
Apr 4, 2005 1 #5 columb IS-IT--Management Feb 5, 2004 1,231 EU As this is turning up every month or so I've written faq80-5793 Columb Healy Upvote 0 Downvote
Apr 4, 2005 Thread starter #6 inunix Technical User Jul 30, 2002 53 US Thanks columb.. this is exactly what I want. Many thanks. It saved me lot of my time. Upvote 0 Downvote