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
Help me While zipping the file Jolly UNIX for Advanced & Expert Users 7 05-11-2007 11:05 AM
Zipping dreams5617 UNIX for Dummies Questions & Answers 1 02-11-2007 08:03 PM
zipping in a loop kotasateesh Shell Programming and Scripting 2 01-10-2007 08:14 AM
Zipping the dir dreams5617 Shell Programming and Scripting 1 07-26-2006 01:20 AM
zipping across platforms MizzGail UNIX for Dummies Questions & Answers 8 05-19-2005 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 08-03-2006
baltdcguy baltdcguy is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 1
script for zipping old directories

This has probably been asked before, but could not find it. I want to tar and zip directories that are over 30 days old and then delete the directory.

Thanks,
Kyle
  #2 (permalink)  
Old 08-03-2006
ebbtide ebbtide is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 5
how 'bout this?

Code:
#find em
FILELIST=`find ./ -mtime +30 -type d`

# tar em
for i in $FILELIST; do
       tar cvf $i'tar' $i
done    

# delete em
for i in $FILELIST; do
       rm -rf $i
done
  #3 (permalink)  
Old 08-03-2006
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 188
Ebbtide,

This takes into consideration the UNIX time but not when the direcotry is created. If we need to consider the date the dir or file is created what is the procedure?
  #4 (permalink)  
Old 08-03-2006
ebbtide ebbtide is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 5
AFAIK The actual creation time is not tracked. The man page for stat reveals the 3 different valus you can key off of...

st_atime
Time when file data was last accessed. Changed by the
following functions: creat(), mknod(), pipe(),
utime(2), and read(2).

st_mtime
Time when data was last modified. Changed by the fol-
lowing functions: creat(), mknod(), pipe(), utime(),
and write(2).

st_ctime
Time when file status was last changed. Changed by the
following functions: chmod(), chown(), creat(),
link(2), mknod(), pipe(), unlink(2), utime(), and
write().
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:27 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