Deletes view-private files from a ClearCase view in Windows.
It should work in UNIX, too, but I think the Win32 category fits better because on unix you could simply do:
cleartool lspriv -s -oth | xargs rm -rf
#!/usr/bin/perl
# rmpriv [-q]
# Removes view private files (not checked-out files).
# Must be invokes within a ClearCase view.
use Getopt::Std;
getopts("q"); # quiet
my $lspriv = "cleartool lspriv -short -other";
open(LSPRIV, "$lspriv|") || die("Could not list private files");
my @files = <LSPRIV>;
close LSPRIV;
die("Error running cleartool lspriv") if ($? >> 8);
# chomp (@files);
my $count = 0;
print "Found " . scalar @files . " files.\n" unless $opt_q;
foreach my $file (sort {$b cmp $a} @files)
{
chomp($file);
$count += rmdir($file) if -d $file;
$count += unlink($file) unless -d $file;
print "deleted $file\n" unless -e $file || $opt_q;
}
print "Deleted $count files.\n" unless $opt_q;