如何有效地维护最新的快照tar档案?

我有一个大的文件目录,我想保持一个压缩的tar压缩文件,我可以通过HTTP服务器,包含所有的文件,每天都会提交一次。

许多文件不会每天都在改变,而且我希望避免每个小时的处理器时间压缩相同的文件。

焦油“不能更新压缩的档案”,所以tar uj不会帮助。

有没有一个聪明的方法来做到这一点?

因为这是通过http访问的,所以使用PHP来使用这样的东西来即时生成tar文件:

 <?php set_time_limit(1); header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: application/x-bzip2; charset=binary"); header("Content-Disposition: attachment; filename=\"archive.tar.bz2\";" ); passthru("tar cj --exclude-vcs /path/to/files",$err); if ($err) { error_log("exit value: $err"); } exit; 

显然,这对于这个文件将被下载很多的情况没有帮助。

这个想法是在竞争对手的build议论坛 。

 tar cf --newer YYYYMMDD To copy differences or only the files since the last tar date here is the command. Let's say we did a tar on Feb 9th, 2009 as follows: (cd /mydata; tar cf - *) | tar xvf - Today is Feb 11th and we only want to copy the files that have changed since Feb 9th, 2009. The command would be (cd /mydata; tar cf - --newer 20090209 * ) | tar xvf -