LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 12-30-2005, 02:16 PM   #1
rayia
LQ Newbie
 
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
tar a date range


I'm trying to figure out how to tar a set of log files based on date range, but so far I'm getting frustrated by not finding the correct date combination. I've tryed:

'tar cvNf testarchive --newer=200511010001 [file names]'

Any help on how badly I've messed up the line?
 
Old 12-30-2005, 03:00 PM   #2
Finlay
Senior Member
 
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029

Rep: Reputation: 47
i would use
ls
then pipe | it through
grep
if you need to fine tune it, then pipe | it through
tar
 
Old 12-31-2005, 11:18 AM   #3
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
find is the tool to get your file list, Checkout the -newer and -mtime options.
 
Old 01-03-2006, 08:52 AM   #4
rayia
LQ Newbie
 
Registered: Dec 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Got it working!

Thanks for the help. Here's the line I ended up with:

tar cfvz filename.tgz `find ./200* -ctime +60 ! -ctime +90`

The log files are from a Checkpoint firewall. I only want them left there for 60 days and then I pull them off to a server with a CD burner. All the names begin with yyyy, hence the 200*.

Now If I can just virtualize the filename and automate the FTP.....

Thanks again
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 10 02-23-2008 06:40 AM
Getting date format right in tar incremental backup jonr Linux - Software 3 08-19-2004 10:53 AM
tar file name with system date mnauta Linux - General 4 12-19-2003 05:48 PM
Set name of tar file as date using bash otisthegbs Linux - Software 5 12-18-2003 04:34 PM
lastlog date does not match system date? jcmj Linux - Networking 6 10-22-2002 01:09 PM


All times are GMT -5. The time now is 12:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration