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
How to delete files ?? preethgideon UNIX for Dummies Questions & Answers 5 10-29-2007 12:51 AM
Delete files with 0kb mephisto UNIX for Dummies Questions & Answers 3 10-23-2006 07:45 AM
how to delete log files castlerock Shell Programming and Scripting 2 03-29-2006 12:42 PM
when I try to run rm on multiple files I have problem to delete files with space umen UNIX for Dummies Questions & Answers 1 09-20-2005 12:20 AM
I can't delete some files DISTURBED UNIX for Dummies Questions & Answers 4 08-01-2002 08:15 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-06-2007
Registered User
 

Join Date: Dec 2007
Posts: 5
Stumble this Post!
How to delete files with certain ext?

Hi All,

How can I work on following request?

Delete all the html files older than 29th November from the path - /dding/ting/tong/unixyang/output
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-06-2007
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 709
Stumble this Post!
Post

Perform appropriate calulation to determine how many days ago 29th of november was, assign to $days.

find /dding/ting/tong/unixyang/output/ -name "*.html" -mtime $days -exec rm {} \;

To test, omit the "-exec rm {} \;" part of the above command
Reply With Quote
  #3 (permalink)  
Old 12-06-2007
Registered User
 

Join Date: May 2005
Posts: 37
Stumble this Post!
find /dding/ting/tong/unixyang/output/ -name "*.html" -mtime $days -print
Reply With Quote
  #4 (permalink)  
Old 12-07-2007
Registered User
 

Join Date: Dec 2007
Posts: 5
Stumble this Post!
Thanks everyone. It worked.

Could also tell me how can I do the request where user have asked to remove all files from certain directory with .html extension.
Reply With Quote
  #5 (permalink)  
Old 12-09-2007
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 709
Stumble this Post!
Quote:
Originally Posted by tonyvirk View Post
Thanks everyone. It worked.

Could also tell me how can I do the request where user have asked to remove all files from certain directory with .html extension.
rm <directory>/*.html (eg rm /dding/ting/tong/unixyang/output/*.html)

Or if it should recurse to find all html files in subdirectories too:

rm -r <directory>/*.html (be careful to type this correctly)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:23 PM.


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

Content Relevant URLs by vBSEO 3.2.0