summaryrefslogtreecommitdiffstats
path: root/support/files-to-excludes
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 16:14:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 16:14:31 +0000
commit2d5707c7479eacb3b1ad98e01b53f56a88f8fb78 (patch)
treed9c334e83692851c02e3e1b8e65570c97bc82481 /support/files-to-excludes
parentInitial commit. (diff)
downloadrsync-2d5707c7479eacb3b1ad98e01b53f56a88f8fb78.tar.xz
rsync-2d5707c7479eacb3b1ad98e01b53f56a88f8fb78.zip
Adding upstream version 3.2.7.upstream/3.2.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'support/files-to-excludes')
-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 0000000..a28955c
--- /dev/null
+++ b/support/files-to-excludes
@@ -0,0 +1,27 @@
+#!/usr/bin/env 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";