The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Purging a Set of Files svishh123 Shell Programming and Scripting 5 05-31-2007 04:21 PM
FTP - To handle error while transferring files mahalakshmi Shell Programming and Scripting 1 04-04-2007 03:56 AM
Script error.. for comparing 2 files! gkrishnag UNIX for Advanced & Expert Users 4 09-13-2006 09:19 AM
Dvd files concatenate error: Not enough space maag SUN Solaris 3 05-06-2006 10:39 PM
Purging script egls Shell Programming and Scripting 2 02-28-2006 02:01 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-31-2007
svishh123 svishh123 is offline
Registered User
  
 

Join Date: May 2007
Posts: 5
Error While Purging Files

find /filearchive/ -type f -mtime +7 -exec rm weblogs*.log {} \;

This worked only if this comand is executed int he unix comand prompt, but when i put this in the shell script it is not recognizing the file.It says weblogs: No such file or directory

Am i doing anything wrong here ?
  #2 (permalink)  
Old 05-31-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
svish,
Your "find" statement is not correct.
See a proper version:
Code:
find /filearchive/ -type f -name 'weblogs*.log' -mtime +7 -exec rm {} \;
  #3 (permalink)  
Old 05-31-2007
svishh123 svishh123 is offline
Registered User
  
 

Join Date: May 2007
Posts: 5
Shell,

Actually this option removes the fiels first and then doing a FInd over that.What is required is have to find the list of such files and then remove them.
Can i pipe the find results to rm ?
  #4 (permalink)  
Old 05-31-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,522
have you tried the command yet? try it first before posting
  #5 (permalink)  
Old 05-31-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by svishh123
Can i pipe the find results to rm ?
find directory -print | xargs -n 20 rm
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0