summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-01-30 21:52:17 +0000
committerWayne Davison <wayned@samba.org>2006-01-30 21:52:17 +0000
commitb587adda1fba778ffd9a68a00798dea787ba1dc5 (patch)
tree052c0ab2ed5c03a377d9acd736e90c9fb19d1c02 /support
parent50fd4832c244422436fc657b95c94139e89602af (diff)
downloadrsync-b587adda1fba778ffd9a68a00798dea787ba1dc5.tar.gz
rsync-b587adda1fba778ffd9a68a00798dea787ba1dc5.tar.bz2
rsync-b587adda1fba778ffd9a68a00798dea787ba1dc5.zip
This perl script automates the conversion of a list of pathnames
to a set of includes/excludes needed for rsync to copy just the listed files.
Diffstat (limited to 'support')
-rwxr-xr-xsupport/files-to-excludes27
1 files changed, 27 insertions, 0 deletions
diff --git a/support/files-to-excludes b/support/files-to-excludes
new file mode 100755
index 00000000..5fb13b08
--- /dev/null
+++ b/support/files-to-excludes
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+# This script takes an input of filenames and outputs a set of
+# include/exclude directives that can be used by rsync to copy
+# just the indicated files using an --exclude-from=FILE option.
+use strict;
+
+my %hash;
+
+while (<>) {
+ chomp;
+ s#^/+##;
+ my $path = '/';
+ while (m#([^/]+/)/*#g) {
+ $path .= $1;
+ print "+ $path\n" unless $hash{$path}++;
+ }
+ if (m#([^/]+)$#) {
+ print "+ $path$1\n";
+ } else {
+ delete $hash{$path};
+ }
+}
+
+foreach (sort keys %hash) {
+ print "- $_*\n";
+}
+print "- /*\n";