2001-01-02-15:32:35 Goswin Brederlow:
> rsync $FLAGS $HOST::debian/pool/ --include-from .filelist --exclude '*' $DEST/pool/
>
> This will mirror everything from HOST::debian/pool to DEST/pool, so
> there you see how to shorten the path.
>
> But "--exclude '*'" will ignore all files except what has been allowed
> by "--include-from .filelist".
An additional frob worth noting is that this isn't _quite_ as
simple as you might hope; as explained in the rsync man page, the
matching of files against include/exclude patterns is tried with
each directory prefix leading up to the path, which means to sync
the file a/b/c you need to include (in .filelist, in the above
example):
a/
a/b/
a/b/c
The attached perl script will take a list of files and fill in the
needed parent directories.
-Bennett
#!/usr/bin/perl -w
use strict;
use File::Basename;
sub f {
if ($_[0] =~ /\//) {
return f(dirname($_[0])), $_[0]."/";
} else {
return $_[0]."/"
}
}
while (<>) {
chomp;
print $_,"\n" for f(dirname($_)),$_;
}
PGP signature