Subject: Re: Tar and Find Problem
To: Torsten Schlueter <t.schlueter@gmx.de>
From: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
List: netbsd-users
Date: 07/08/1998 09:25:57
On Wed, Jul 08, 1998 at 11:09:20AM +0100, Torsten Schlueter wrote:
>
> I was trying to update my Homepage when i noticed that it is not
> possible (for me) to put only those files in an tar archive which were
> changed.
>
> I tried the following:
>
> t-rex://usr/local/httpd/htdocs/ #find . -mtime 1 -print
>
> and the output were the files which are changed today.
What were the contents of /tmp/webneu.files? I'm guessing it
was also including directories (they have modification times too,
of course), and if tar gets a request to add a directory, it
adds everything in the subdirectory.
# cd /tmp
# mkdir newdir
# cd newdir
# touch a
# touch b
# find . -mtime 1 -print
./a
./b
# find . -mtime 1 -print
.
./a
./b
For some reason, the first find doesn't see the directory, but
the second does.
ANYWAY, one work around is to use find . -mtime 1 -type f
-print, which will limit the output to print regular files. Or,
use find . -mtime 1 \! -type d -print, to exclude directories.
You might want to also look at the -N (or --newer) option to
tar. I'm not sure what date format it expects, though.
Hope this helps!
Brian
--
"...just take everything you know and shove it up by 12."
Mark Krentel, COMP 280