![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 ? |
|
|||||
|
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 |
|
||||
|
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? |
|
||||
|
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 ? ![]() |
|
||||
|
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 | ||
|
|
![]() |
| Bookmarks |
| Tags |
| mtime |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|