What's wrong with this command?

AZ_Pete plug-discuss@lists.PLUG.phoenix.az.us
Tue, 26 Jun 2001 15:09:43 -0700


See comments below...
What is the exact problem your having with this command?
Peter


>Isn't the standard tar command 'tar -czvf file.tar.gz files2tar'?  So All I
>am doing by the first part is filling in the where to source from and where
>to put it, right?

This form of tar is the standard way to use it.  In your case, since your
find command is returning only directories, this should work.
But if find is returning files, this command would result in the
backup.tar.gz always having only one file in it.

> 2) If find returns many, many files the script will be slow because of
> calling tar so many times. I would recommend using xargs to pass the files
> to tar.

>Could you explain how this would speed it up, I'm confused?

The exec argument of find will execute the command given for each
file/directory that find returns.
So if your perform a find ./ -name '*.html'  -exec some-command {}\; and
find returns 500 html files, some-command will be called 500 times.
If you were to use xargs, it would take some-command as the 1st parameter
and pass the list of 500 html files to some-command in chunks of 20 (I
believe 20 is the default).  That way some-command will only be executed 25
times, rather than 500.  You can set how many files xargs operates on at one
time via a flag.

> 3) I am unclear on your need to recreate the directory structure.

This was decided for me.. :(