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 > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
scripting problem ( KSh ) dhananjayk Shell Programming and Scripting 2 11-20-2006 09:34 AM
scripting problem bebop1111116 Shell Programming and Scripting 0 09-19-2006 08:06 PM
scripting problem ust Shell Programming and Scripting 3 02-20-2005 04:12 AM
Scripting problem Robin Shell Programming and Scripting 2 03-14-2003 05:45 AM
awk scripting problem jinky Shell Programming and Scripting 2 05-15-2002 10:15 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 12-07-2006
msbinu msbinu is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 4
scripting problem

hI

I m very new to unix ,...
I m facing an issue

I have to search though a list of directorys, find all .gz files which are older than 7 days and delete that ,,,

Any one knows a single command to do this ..

Thnks in advance
BInu
  #2 (permalink)  
Old 12-07-2006
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,754
Code:
while read dir 
do
     find $dir -name '*.gz' -mtime +7 -exec rm -f {} \;
done < dirlistfile
You have to do this becuase find requires one path per command instance.
  #3 (permalink)  
Old 12-07-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
For a single command, how about this:
Code:
find <list of directories> -name \*.gz -mtime +6 -exec echo removing {} \; rm -f {} \;
I know that jim's post has -mtime +7, and I've got +6, but take a look at this thread, and read Perderabo's last post.
  #4 (permalink)  
Old 12-08-2006
msbinu msbinu is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 4
thnaks a lot .. it worked
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 08:13 PM.


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