windows-nt/Source/XPSP1/NT/admin/admt/buildtools/getlastbuilddir.pl

25 lines
484 B
Perl
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
$rootdir = $ARGV[0];
$lastbuild = 0;
if ( ! $rootdir )
{
print "Usage: GetLastBuildDir.pl <Parent Archive Directory>\n";
}
else
{
if ( ! opendir( INPUTDIR, $rootdir ) )
{
print "Error opening directory $rootdir: $!\n";
}
else
{
while( $dir = readdir( INPUTDIR ) )
{
( $dir =~ /Build(\d+.*)/ ) && ( $1 > $lastbuild ) && ( $lastbuild = $1 );
}
closedir INPUTDIR;
print "Last build = $lastbuild\n";
}
}
exit $lastbuild;