mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
66 lines
1.7 KiB
$path = $ARGV[0];
|
|
|
|
if ( ! $path )
|
|
{
|
|
print "Usage: RemoveVssInfo.pl <Directory Path>\n";
|
|
}
|
|
else
|
|
{
|
|
if ( -d $path )
|
|
{
|
|
open( INPUTDIR, "dir \"$path\\*.ds?\" /b /s |" ) ||
|
|
die "Error opening directory $path: $!\n";
|
|
|
|
while(<INPUTDIR>)
|
|
{
|
|
/^(.*)$/ && ( $filename = $1 );
|
|
if ( -f "$filename.bak" ) { system( "del /f \"$filename.bak\"" ); }
|
|
if ( ! rename( "$filename", "$filename.bak" ) )
|
|
{
|
|
print "Error renaming $filename to $filename.bak: $!\n";
|
|
}
|
|
else
|
|
{
|
|
if ( ! open( INFILE, "$filename.bak" ) )
|
|
{
|
|
print "Error opening $filename.bak: $!\n";
|
|
}
|
|
else
|
|
{
|
|
if ( ! open( OUTFILE, ">$filename" ) )
|
|
{
|
|
print "Error opening $filename: $!\n";
|
|
}
|
|
else
|
|
{
|
|
$SccBlock = 0;
|
|
$SccProp = 0;
|
|
while(<INFILE>)
|
|
{
|
|
/^\# PROP Scc\_/ && ( $SccProp = 1 );
|
|
/begin source code control/ && ( $SccBlock = 1 ) && ( $SccProp = 1 );
|
|
/end source code control/ && ( $ SccBlock = 0 );
|
|
|
|
if ( $SccProp )
|
|
{
|
|
( ! $SccBlock ) && ( $SccProp = 0 );
|
|
}
|
|
else
|
|
{
|
|
print OUTFILE $_;
|
|
}
|
|
}
|
|
close OUTFILE;
|
|
}
|
|
close INFILE;
|
|
}
|
|
}
|
|
}
|
|
close INPUTDIR;
|
|
}
|
|
else
|
|
{
|
|
print "You must specify a directory path.\n";
|
|
}
|
|
}
|
|
exit 0;
|