LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   tar a date range (https://www.linuxquestions.org/questions/programming-9/tar-a-date-range-397925/)

rayia 12-30-2005 01:16 PM

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?

Finlay 12-30-2005 02:00 PM

i would use
ls
then pipe | it through
grep
if you need to fine tune it, then pipe | it through
tar

eddiebaby1023 12-31-2005 10:18 AM

find is the tool to get your file list, Checkout the -newer and -mtime options.

rayia 01-03-2006 07:52 AM

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


All times are GMT -5. The time now is 06:57 PM.