The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find 3 months old log files and remove cvdev SUN Solaris 13 05-22-2008 10:38 AM
Deleting the files comparing the creation dates pssandeep UNIX for Dummies Questions & Answers 2 04-10-2008 07:54 AM
Files and dates mastachef UNIX for Dummies Questions & Answers 1 12-03-2007 11:12 AM
Last modification times of files less than 6 months old Abhishek Ghose UNIX for Dummies Questions & Answers 1 10-19-2005 04:37 AM
Listing files older than 2 months pbekal Shell Programming and Scripting 3 01-17-2002 11:12 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 11-07-2005
Registered User
 

Join Date: Nov 2005
Posts: 3
deleting files with dates 3 months ago

please help me with this?????

i need to create a program that will run in unix that will delete all files in a given directory that is at least 3 months old. first the program will need to automatically know what date it is right now to determine the files it will delete...guys help me please
Reply With Quote
Forum Sponsor
  #2  
Old 11-07-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,683
Use the forum's search feature.

command unix to list all files created since n month ago
Listing files older than 2 months
Reply With Quote
  #3  
Old 11-07-2005
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
try this:
Code:
find the_directory -type f -ctime +90 -exec rm -f {} \;
Reply With Quote
  #4  
Old 11-08-2005
Registered User
 

Join Date: Nov 2005
Posts: 3
hey guys thanks a lot;

Just thinking if i can use the same code with the same result using korn shell, will this program work as well:


#!/bin/ksh

find /export/home/zzgodae/archive -type f -ctime +90 -exec rm -f {} \;




thanks again

Last edited by godalle; 11-08-2005 at 01:27 AM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:14 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0