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 Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
delete file older than N days ericaworld Shell Programming and Scripting 7 02-21-2008 08:34 AM
Command for delete the directories which are older than 7 days sridhar sivakot HP-UX 1 02-15-2008 09:11 AM
Delete user file(s) older then 'X' days ?? varungupta UNIX for Advanced & Expert Users 2 08-24-2007 05:01 AM
delete files and folders older than 3 days melanie_pfefer Shell Programming and Scripting 7 12-18-2006 12:58 PM
delete files older than 7 days lesstjm UNIX for Dummies Questions & Answers 1 11-06-2001 10:43 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-25-2002
odogbolu98 odogbolu98 is offline
Registered User
  
 

Join Date: Jan 2002
Location: Minnesota
Posts: 32
Question How can I delete files older than 7 days?

I will like to write a script that delete all files that are older than 7 days in a directory and it's subdirectories. Can any one help me out witht the magic command or script?

Thanks in advance,

Odogboly98
  #2 (permalink)  
Old 02-26-2002
witt
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Hello !

The command is :

find /your_directory -mtime +7 -exec rm -f {} \;

Witt
  #3 (permalink)  
Old 02-26-2002
odogbolu98 odogbolu98 is offline
Registered User
  
 

Join Date: Jan 2002
Location: Minnesota
Posts: 32
Thanks witt for your reply,

That was realy very helpful. But how do you implement this command to scan through several subdirectories and subsequently remove files that are older than 7 days of those subdirectories.

Thanks,

Odogbolu98
  #4 (permalink)  
Old 02-26-2002
witt
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Hello !

No problem to search file through subdirectories.

Look this :

DESCRIPTION
The find utility recursively descends the directory hierar-
chy for each path seeking files that match a Boolean expres-
sion written in the primaries given below.

This description is in the man. Any doubt, execute "man find" into unix command line.

Witt
Sponsored Links
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 01:18 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