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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Deleting files older than 7 days shezam Shell Programming and Scripting 4 07-09-2008 05:40 AM
Deleting / finding files older than X days missess a day guruparan18 Shell Programming and Scripting 4 05-08-2008 07:09 AM
Script to pick out files from a file which are older than 15 days viv1 Shell Programming and Scripting 1 04-02-2008 10:42 AM
delete file older than N days ericaworld Shell Programming and Scripting 7 02-21-2008 08:34 AM
tar files older than 30 days wfch UNIX for Dummies Questions & Answers 6 04-19-2004 05:40 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 06-24-2008
moon_friend moon_friend is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 3
Script for deleting 30 days older

Hi,

I need a script to delete files that are 30 days older and also the file name should contain aa or ab or ac as substring...

Regards,
Dolly....
  #2 (permalink)  
Old 06-24-2008
incredible incredible is offline Forum Advisor  
Registered User
  
 

Join Date: May 2008
Location: s'pore
Posts: 2,091
find /someDirectory -type f -name *aa* -atime +30 -exec rm {} \;
  #3 (permalink)  
Old 06-24-2008
moon_friend moon_friend is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 3
Hey sorry to bother....

Im new to scripting........

wts the function of "-atime" ?

can we use or condition in Scripts bcos i need to delete a filename which could either contain aa or ab or ac as substring.......

Thanx a lot....
  #4 (permalink)  
Old 06-24-2008
spirtle spirtle is offline
Registered User
  
 

Join Date: Jun 2008
Location: Scotland
Posts: 150
Read man find to find out all about -atime and its friends.
To match aa, ab or ac sunstrings in the filename, use a regexp like
Code:
find . -name "*a[abc]*
The bit in brackets means "match any of these characters".
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 09:57 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