windows-nt/Source/XPSP1/NT/admin/admt/buildtools/getlastbuilddir.pl
2020-09-26 16:20:57 +08:00

25 lines
484 B
Perl

$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;