Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-13-2005, 09:03 AM   #1
LQ Newbie
Registered: Jan 2005
Location: Luxembourg
Posts: 2

Rep: Reputation: 0

Does anybody know how to archive files before a certain date with tar.
I know there is this function --newer.
Thank you very much guys in advance.

Old 01-13-2005, 09:53 AM   #2
Registered: Jan 2005
Location: Budapest/Hungary
Distribution: knoppix-hdd/debian
Posts: 56

Rep: Reputation: 15
You can generate the filelist with find and use it's output for tar.
man find

e.g. the command

find /dir/to/backup -ctime -1 -type f

gives all the files which were last changed 1 days and before (the minus sign). so, if you want to tar these files simply extend this with tar:

tar czvf backup.tar.gz `find /dir/to/backup -ctime -1 -type f`

and so on. This is the unix philosophy. Small programs do what they need to do and you can pipe them together :-)

I hope it will solve your problem.
Old 01-13-2005, 10:21 AM   #3
Registered: Feb 2004
Location: Belgium
Distribution: Ubuntu 10.04 Lucid Lynx
Posts: 140

Rep: Reputation: 15
You could also write a shell script.
Old 01-14-2005, 05:42 AM   #4
LQ Newbie
Registered: Jan 2005
Location: Luxembourg
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks bbk, I'll try that.



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 14 10-25-2016 03:48 AM
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 11:55 AM
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 12:02 PM
.rpms, .tar.gz, .tgz, .src.rpm, & .tar.bz2 whoots Mandriva 10 10-18-2003 01:08 PM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 07:30 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:29 PM.

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