Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

rmpriv.pl

by Iron-Jeff (Acolyte)
on Oct 08, 2002 at 21:48 UTC ( #203767=sourcecode: print w/replies, xml ) Need Help??
Category: Win32 Stuff
Author/Contact Info
Description: 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;
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://203767]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2020-09-22 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (130 votes). Check out past polls.

    Notices?