#!/usr/local/bin/perl -w # Print all files which are in CVS repository. Obvious usage is to create # archive of all files from repository which is full of other junk (this always # happens to me :-) # # It will dump all find on STDOUT, just like "find . -type f -print" # and dump some debugging output on STDERR # # 2003-08-06 Dobrica Pavlinusic use English; use strict; my @dirs = shift @ARGV || '.'; sub read_entries { my $dir = shift; my @in_cvs; if (open(E, "$dir/CVS/Entries")) { while() { chomp; next if (m#^D#); s#^/([^/]+)/.+/#$1#; push @in_cvs,$_; } close(E); } return @in_cvs; } while (@dirs) { my $curr_dir=shift @dirs; opendir(DIR,$curr_dir) || warn "opendir '$curr_dir': $!"; my @ignore = ('.', '..', 'CVS'); #print STDERR "ignore: ",join("|",@ignore),"\n"; my @in_cvs = read_entries($curr_dir); my @clutter = readdir(DIR); foreach my $file (@clutter) { if (-d "$curr_dir/$file" && grep(/^\Q$file\E$/,@ignore) == 0 && -r "$curr_dir/$file") { push @dirs,"$curr_dir/$file"; } else { if (grep(/^\Q$file\E$/,@in_cvs) == 0) { print STDERR "skip: $curr_dir/$file\n"; } else { my $cvs_file = "$curr_dir/$file"; $cvs_file =~ s#^\./##; $cvs_file =~ s#//#/#g; print "$cvs_file\n"; } } } }