LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar (https://www.linuxquestions.org/questions/linux-newbie-8/tar-277295/)

koda0505 01-13-2005 08:03 AM

tar
 
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.

Koda0505

bbk 01-13-2005 08:53 AM

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.

Error1312 01-13-2005 09:21 AM

You could also write a shell script.

koda0505 01-14-2005 04:42 AM

Thanks bbk, I'll try that.

Koda0505


All times are GMT -5. The time now is 05:50 AM.