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
Help Required: Command to find IP address and command executed of a user loggedout Security 2 08-06-2008 05:12 PM
how to? launch command with string of command line options TinCanFury Shell Programming and Scripting 5 04-28-2008 03:06 PM
inconsistent ls command display at the command prompt & running as a cron job rajranibl Linux 5 07-30-2007 05:26 AM
How to use more than one MPE command STREAM with Unix command in a single shell? bosskr HP-UX 1 10-16-2006 01:16 PM
How to use more than one MPE command STREAM with Unix command in a single shell? bosskr Shell Programming and Scripting 0 09-19-2006 06:44 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #15  
Old 04-12-2007
Registered User
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Deleting Files between two date ranges

This will help you to remove all the files between the two date ranges ie ( all files between May-2-2005 & June-6-2005)

HTML Code:
find <your-dir> -name '*' \( -newer /tmp/May-2-2005 -a ! -newer /tmp/June-6-2006 \) -ok rm {} \;
Please run the commands mentioned in the previous post.Once you confirm the results,try running the above command,here "ok" used inplace od "exec" will wait for you confirmation before proceeding with the rm

Thanks
Nagarajan Ganesan.
Reply With Quote
Forum Sponsor
  #16  
Old 04-12-2007
Registered User
 

Join Date: Apr 2007
Posts: 24
Thanks ennstate for your help but I am going to go Shell Life's route!! I really appreciate your help though.
Reply With Quote
  #17  
Old 04-14-2007
Registered User
 

Join Date: May 2006
Posts: 63
i need the log files for the files which are 2 days older before deleting the files
Reply With Quote
  #18  
Old 04-14-2007
Registered User
 

Join Date: May 2006
Posts: 63
Just to be very clear i need to generate a log file in which the file name should be there before deleting the files which are two days older .. can anyone can help me on this .. Thanks in advance !!
Reply With Quote
  #19  
Old 04-14-2007
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,590
Comment the second of these two lines in the option you already chose to use.
The output file will contain the list.

Code:
ls -1t | sed -n "/$$END_FILE/,/$$START_FILE/p" > $$rm_FILE
sed 's/^/rm -f /' $$rm_FILE > FINAL_rm_FILE
Reply With Quote
  #20  
Old 04-14-2007
Registered User
 

Join Date: May 2006
Posts: 63
i am using this command find * -type f -atime +30 -exec gunzip {} \; for unzipping the files which are 30 days older .. but how can i get the log for which files the command has unzipped ..

This should be in a single line ..

Thanks!!
Reply With Quote
  #21  
Old 04-14-2007
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,590
The simplest way would be to run the command twice, once without the exec, to list the files, the second with the exec to extract them.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
mtime

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:20 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