#! /usr/bin/env perl


#CleanFromPath(".");

#my $dir = "/afs/cs.wisc.edu/p/condor/public/binaries/stable/v6.6";
my $dir = "/scratch/bt/tarballnames";
my $match = "";

opendir DH, $dir || die "Failed to pen dir $dir: !$\n";
foreach $file (readdir DH)
{
	if($file =~ /condor-(\d+)\.(\d+)\.(\d+)-.*/ )
	{
		$match = "condor-$1.$2.$3";
		print "Matching directory is $match\n";
	}
	else
	{
		print "Missed matching $file..... why?\n";
	}
}

exit(0);

sub CleanFromPath
{
	my $pulldir = shift;
	my $path = $ENV{PATH};
	my $newpath = "";
	
	my @pathcomponents = split /:/, $path;
	foreach my $spath ( @pathcomponents)
	{
		if($spath ne "$pulldir")
		{
			$newpath = $newpath . ":" . $spath;
		}
	}
}

