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
Deleting files older than 7 days shezam Shell Programming and Scripting 4 07-09-2008 04:40 AM
delete files and folders older than 3 days melanie_pfefer Shell Programming and Scripting 7 12-18-2006 12:58 PM
tar files older than 30 days wfch UNIX for Dummies Questions & Answers 6 04-19-2004 04:40 AM
How can I delete files older than 7 days? odogbolu98 UNIX for Dummies Questions & Answers 3 02-26-2002 08:35 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 04-20-2007
texasoeb texasoeb is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 2
Removing files older than 7 days

Script help, I need to delete files that are older than 7 days. I do that automatically but I know that a cron job can do the job for me. Any help is greatly appreciated, as you can see, I am a DOS or WINDOWS guy. Little on UNIX. Thanks
  #2 (permalink)  
Old 04-20-2007
awk awk is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
find ./ -type f -mtime +7 -exec rm -f {} \;

Warning, as coded, this will remove ALL files in the current directory and all subdirectories that were not either created or modified in the last 7 days.

Other coding will be necessary to restrict to only current directory.
  #3 (permalink)  
Old 04-20-2007
Mike O Mike O is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 1
I want to move all files older than 1 day to an archive directory that is a subdirectory. How do I do that without whacking my archive which is a subdirectory?
  #4 (permalink)  
Old 04-20-2007
texasoeb texasoeb is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 2
great, assuming I know that the files are all sport.xxxx where .xxxx is the current date e.g. 0420 for April 20, and also assuming we know the directory, I could write the code as: find \usr3\export\sport.* -type f -mtime +7 -exec rm -f; does this code will find files that are older than 7 days with the name bag.*** and delete them? thanks for the help
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 12:12 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