Use tar to append?
Cameron Simpson
cs at zip.com.au
Fri Mar 9 22:37:40 UTC 2007
On 09Mar2007 16:13, Mike McCarty <Mike.McCarty at sbcglobal.net> wrote:
| Cameron Simpson wrote:
| >| (2) I don't
| >| want a detailed report, I want a progress report so I can know
| >| approx. how much has been done.
| >Which is why I suggested you do something other than "cat", like "grep".
| >You post process the tvf output as you see fit.
|
| Ok. Makes sense. I'll need to learn a little more shell syntax
| to do that.
You want this:
while read -r perm own size date time path
do
case "$path" in
your-interesting-paths...)
echo "$path" | wall
;;
esac
done
or something like it.
| >The other way, which is a little harder, is to run a "tar cvf" and post
| >process its output as it goes. Have a look at "entar", a script of mine
| >which
| >does exactly that:
| > http://www.cskk.ezoshosting.com/cs/css/bin/entar
|
| Thanks, I'll have a look.
Ok. Note you won't need cs::Misc or cs::Upd for your needs (though they
are in the cs/ subdir of that folder). Rip 'em out and do what you want.
I have also thought of a much simpler way to solve your problem.
The trailer record is the source of all our pain. Write a small perl or
python or C program that seeks to the end of stdout minus the length of
the trailer record then execs a "tar cf - ..." for you. Thus:
echo "first-directory" | wall
tar cf tarfile first-directory
for toplevel in the-other-directories
do
echo "$toplevel" | wall
tarbackseek tarfile "$toplevel"
done
and make tarbackseek do something like this:
main(int argc, char *argv[])
{ int tarfd=open(argv[1],"w+");
close(1);
dup(tarf,1);
close(tarfd);
lseek(1,SEEK_END,-512);
execvp("tar","cf","-",argv[2],NULL);
}
That C code is approximate and lacking headers, and I need to verify
that the trailer record is 512 bytes (it should be), but you get the
idea I'm sure.
I need to go out, can hack in detail later.
Cheers,
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
I knew I was a real biker when I pulled up beside a car at a stoplight and
the people inside locked all the doors.
More information about the fedora-list
mailing list