Leaked source code of windows server 2003
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.

46 lines
1.0 KiB

  1. my $srcdir = $ARGV[0];
  2. my $bindir = $ARGV[1];
  3. my $target = $ARGV[2];
  4. my @files;
  5. ### TODO
  6. print "srcdir ==> $srcdir\n";
  7. print "bindir ==> $bindir\n";
  8. print "target ==> $target\n";
  9. @files = GetFiles($srcdir);
  10. &ProcessFiles($srcdir, ".", \@files, $bindir, $target);
  11. sub ProcessFiles($$\@$$)
  12. {
  13. my $root = shift;
  14. my $dir = shift;
  15. my $fref = shift;
  16. my $bindir = shift;
  17. my $target = shift;
  18. my ($file, @files);
  19. foreach $file (@$fref) {
  20. if (-d "$root\\$dir\\$file") {
  21. print "mkdir $target\\$dir\\$file\n";
  22. system("mkdir $target\\$dir\\$file");
  23. @files = GetFiles("$root\\$dir\\$file");
  24. &ProcessFiles("$root\\$dir", $file, \@files, $bindir, $target);
  25. } else {
  26. system("copy $bindir\\$dir\\$file $target\\$dir\\$file");
  27. }
  28. }
  29. }
  30. sub GetFiles($)
  31. {
  32. my $srcdir = shift;
  33. my @files;
  34. opendir(DIR, $srcdir);
  35. @files = grep(!/^\.+$/, readdir(DIR));
  36. closedir(DIR);
  37. @files;
  38. }