Source code of Windows XP (NT5)
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

  1. $path = $ARGV[0];
  2. if ( ! $path )
  3. {
  4. print "Usage: RemoveVssInfo.pl <Directory Path>\n";
  5. }
  6. else
  7. {
  8. if ( -d $path )
  9. {
  10. open( INPUTDIR, "dir \"$path\\*.ds?\" /b /s |" ) ||
  11. die "Error opening directory $path: $!\n";
  12. while(<INPUTDIR>)
  13. {
  14. /^(.*)$/ && ( $filename = $1 );
  15. if ( -f "$filename.bak" ) { system( "del /f \"$filename.bak\"" ); }
  16. if ( ! rename( "$filename", "$filename.bak" ) )
  17. {
  18. print "Error renaming $filename to $filename.bak: $!\n";
  19. }
  20. else
  21. {
  22. if ( ! open( INFILE, "$filename.bak" ) )
  23. {
  24. print "Error opening $filename.bak: $!\n";
  25. }
  26. else
  27. {
  28. if ( ! open( OUTFILE, ">$filename" ) )
  29. {
  30. print "Error opening $filename: $!\n";
  31. }
  32. else
  33. {
  34. $SccBlock = 0;
  35. $SccProp = 0;
  36. while(<INFILE>)
  37. {
  38. /^\# PROP Scc\_/ && ( $SccProp = 1 );
  39. /begin source code control/ && ( $SccBlock = 1 ) && ( $SccProp = 1 );
  40. /end source code control/ && ( $ SccBlock = 0 );
  41. if ( $SccProp )
  42. {
  43. ( ! $SccBlock ) && ( $SccProp = 0 );
  44. }
  45. else
  46. {
  47. print OUTFILE $_;
  48. }
  49. }
  50. close OUTFILE;
  51. }
  52. close INFILE;
  53. }
  54. }
  55. }
  56. close INPUTDIR;
  57. }
  58. else
  59. {
  60. print "You must specify a directory path.\n";
  61. }
  62. }
  63. exit 0;