Server : Apache System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : nobody ( 99) PHP Version : 8.1.23 Disable Function : NONE Directory : /usr/share/doc/rsync-3.1.2/support/ |
#!/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";