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
Removing files older than 7 days texasoeb UNIX for Dummies Questions & Answers 3 04-20-2007 04:04 PM
delete files and folders older than 3 days melanie_pfefer Shell Programming and Scripting 7 12-18-2006 12:58 PM
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-14-2004
wfch wfch is offline
Registered User
  
 

Join Date: Apr 2004
Location: Kidderminster, UK
Posts: 4
tar files older than 30 days

Hi there,

I am trying to tar a number of files held in a specific folder. I am only interested in archiving files older than 30 days. Having read through the man entries and all available documentation I thought I'd cracked the coomand with

tar -c -z -v -N 15/04/2004 -f /wfch.tar *

This tar's up the whole of the pwd

Anyone know the correct syntax please ?
  #2 (permalink)  
Old 04-14-2004
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Best way I know is to use a reference file...

Touch a file and use that as the reference date...

# touch -t 03091301 testfile
root:/root/LVMcommands
# ll toddfile
-rw------- 1 root sys 0 Mar 9 13:01 testfile

tar -cvf test.tar `find . -type f -newer testfile`



Here is a link to my question waay back when... with answers... http://forums1.itrc.hp.com/service/f...hreadId=203693
  #3 (permalink)  
Old 04-15-2004
wfch wfch is offline
Registered User
  
 

Join Date: Apr 2004
Location: Kidderminster, UK
Posts: 4
Thanks for this. It really is appreciated

I've been working on it all day. I've checked out the link you provided as well. Every time I try running the command I end up with the folowing:

/export/home/dbadmin/dsoreceipts > ls -l t*
-rw-r--r-- 1 dbadmin academy 0 Jan 1 00:01 testfile
/export/home/dbadmin/dsoreceipts > tar -cvf test.tar 'find . -type f -newer testfile'
tar: find . -type f -newer testfile: No such file or directory

Am I missing something obvious here?
  #4 (permalink)  
Old 04-15-2004
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Should be back tics... not single quotes

` ` not ' '
  #5 (permalink)  
Old 04-15-2004
wfch wfch is offline
Registered User
  
 

Join Date: Apr 2004
Location: Kidderminster, UK
Posts: 4
Thanks again. I thought it was something obvious I'd missed.

I have ran this but it has tarred up all files younger than the reference file. I have tried changing the -newer switch to -after-date but this is classed as a bad option.

I've experimented with the following command and, although not as flexible as your suggestion it's a work around for the time been:

find . -mtime +30 | xargs tar -cvf mar_03.tar

This'll be the last time I ask Todd, but do you have an answer to your orignal reference-file command ?
  #6 (permalink)  
Old 04-15-2004
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
hehe I misread your post... -newer is for more recent files... you wanted OLDER files...

You must use the +N value to do that I think... I thought you had asked about newer...


My bad.



one more note... You can use the -I option to list the full path to the filenames in a file to be backed up... If you can generate a list of the filesyou want to backup, use this option.

find . -mtime +30 > file.out ... then you can run the tar versus a known list of files that you can edit and remove or add filenames.

Last edited by Kelam_Magnus; 04-15-2004 at 11:14 AM..
  #7 (permalink)  
Old 04-19-2004
wfch wfch is offline
Registered User
  
 

Join Date: Apr 2004
Location: Kidderminster, UK
Posts: 4
Thumbs up

Thanks for the additional notes. I've got a file (archive_printlib) which contains a script that now works (example below):

touch -t 19040004 archive_printlib
find . -mtime +19 | xargs rm tick*
find . -mtime +19 | xargs rm hold*
find . -mtime +19 | xargs rm pass*
find . -mtime +19 | xargs rm mdlo*
find . -mtime +19 | xargs rm STAGE*
find . -mtime +19 | xargs rm WFPS*
find . -mtime +19 | xargs rm BMODCL*
find . -mtime +19 > arch.out | xargs tar -cvf mar_04_tar -I /apps/academy/live/hs/printlib/arch.out
compress mar_04.tar
Sponsored Links
Closed Thread

Bookmarks

Tags
mtime

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 11:31 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