The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to delete directories... Stephan Shell Programming and Scripting 8 05-18-2008 08:00 AM
shell script to delete directories... Stephan Shell Programming and Scripting 5 05-16-2008 05:11 AM
delete pattern files in sub directories adurga UNIX for Dummies Questions & Answers 4 03-22-2007 03:41 AM
Delete Directories and Contents t4st33@mac.com UNIX for Dummies Questions & Answers 1 01-16-2007 03:20 PM
Delete old home directories munch UNIX for Dummies Questions & Answers 2 03-01-2006 09:16 PM

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

Join Date: Dec 2005
Posts: 1
Stumble this Post!
need some help with a script to delete directories.

Hello,

I need a hand with a script im trying to make. I have a directory
/usr/db/mail with a bunch of subdirectories such as
/usr/db/mail/domain1.com
/usr/db/mail/domain2.com etc. etc.
all of these directories in turn have sub directories of their own. What I need to do is search all of them and see if there has not been any files written/modified in the past 30 days in any of the sub directories and if so delete the respective /usr/db/mail/domain.com folder. Any assistance would be greatly appreciated.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-12-2005
Just Ice's Avatar
Lights on, brain off.
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 629
Stumble this Post!
cd /usr/db/mail; find . -type d -mtime +30 -exec rm -rf {} \; -print
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:53 AM.


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