File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / support / files-to-excludes
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:32:36 2021 UTC (3 years, 3 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_2_3, HEAD
rsync 3.2.3

    1: #!/usr/bin/env perl
    2: # This script takes an input of filenames and outputs a set of
    3: # include/exclude directives that can be used by rsync to copy
    4: # just the indicated files using an --exclude-from=FILE option.
    5: use strict;
    6: 
    7: my %hash;
    8: 
    9: while (<>) {
   10:     chomp;
   11:     s#^/+##;
   12:     my $path = '/';
   13:     while (m#([^/]+/)/*#g) {
   14: 	$path .= $1;
   15: 	print "+ $path\n" unless $hash{$path}++;
   16:     }
   17:     if (m#([^/]+)$#) {
   18: 	print "+ $path$1\n";
   19:     } else {
   20: 	delete $hash{$path};
   21:     }
   22: }
   23: 
   24: foreach (sort keys %hash) {
   25:     print "- $_*\n";
   26: }
   27: print "- /*\n";

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>