Douglas N. Arnold [[EMAIL PROTECTED]] writes:

>David Bolen <[EMAIL PROTECTED]> writes:
>>> It's possible that this will create empty directories for the tree
>>> even if no files are transferred in that directory (I'm not positive).
>
>Thanks for your reply. But, unfortunately, it does indeed fail because
>of the last point.

Fails because it doesn't transfer the files you want, or fails because
having empty directories on your target is unacceptable?

If the latter, then yes, I think you'll either need to construct a
more precise list of directories on the input side, or perform some
post-processing to prune the resulting tree to remove any empty
directories.

Constructing the list of directories probably wouldn't be too bad -
given a list of files in 'list'.  Looping with dirname could probably
break down the components of a directory.  Say you put the following
into "dirtree.sh" somewhere:

     #! /bin/sh

     dir=`dirname $*`
     while [ "$dir" != "." ]; do
       echo "$dir/"
       dir=`dirname $dir`
     done

then this script will dump each directory in a hierarchy to stdout
(there's probably loads of other ways - probably faster too - to get
the info, but this should work in general).

Then I expect something like this would do it:

   > cat list | xargs -l1 dirtree.sh | sort | uniq >dirlist

and then just specify both dirlist and list with --include directives.

Not the fastest thing in the world, but should do the job.  Depending
on the number or location of files you have, you could probably speed
things up with a first pass through "dirname | sort | uniq" in order
to avoid building trees for a given leaf directory more than once,
but optimizations beyond that get more complicated.

-- David

/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: [EMAIL PROTECTED]  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/

Reply via email to