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
Copy code from shell yohoshua UNIX for Dummies Questions & Answers 1 10-11-2006 11:20 PM
how to convert from korn shell to normal shell with this code? forevercalz Shell Programming and Scripting 21 11-22-2005 10:18 PM
very simple shell thing.. sskb UNIX for Dummies Questions & Answers 2 06-26-2003 03:18 PM
simple shell - how to get a parameter typed in a shell script cmitulescu Shell Programming and Scripting 3 12-05-2001 11:04 AM
A simple shell question a_new_admin Shell Programming and Scripting 2 11-01-2001 09:28 AM

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

Join Date: Oct 2007
Posts: 50
Please verify the simple Shell code

Hi,

i am trying to write script which will delete files(more than 90 days older) from different directories. Please check its ok if i implement it in SUN solaris10; One important thing i used here "exec" flag. I heard from someone- as i have lots of files "exec" flag may give error like too long argument. So, what should i do to remove huge files.

#!/usr/bin/sh

find /var/opt/backup/cam* -mtime +90 -exec rm {} \;
find /var/opt/backup/tmp/zam* -mtime +90 -exec rm {} \;

find /var/opt/otherbackup/cat* -mtime +90 -exec rm {} \;

find /var/opt/otherbackup/cat* -mtime +5 -exec rm {} \;
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-04-2007
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
Try piping to xargs
Code:
find /var/opt/otherbackup/cat* -mtime +5 -print | xargs -n 100 rm -f
... should do the trick
Reply With Quote
  #3 (permalink)  
Old 10-04-2007
Cameron's Avatar
Registered User
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 486
Isn't this a duplicate thread ??? ...
Find files including subdirectory and Delete
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:41 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 Global Fact Book

Content Relevant URLs by vBSEO 3.2.0