ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Utilities/AddDir.pm
(Generate patch)

Comparing COMP/SCRAM/src/Utilities/AddDir.pm (file contents):
Revision 1.3 by williamc, Thu Mar 18 10:32:04 1999 UTC vs.
Revision 1.6 by sashby, Fri May 11 08:49:52 2001 UTC

# Line 3 | Line 3 | require 5.001;
3   require Exporter;
4   use Cwd;
5   @ISA    = qw(Exporter);
6 < @EXPORT = qw(adddir);
6 > @EXPORT = qw(adddir copydir);
7 >
8  
9   sub adddir {
10   my $indir=shift;
# Line 26 | Line 27 | sub adddir {
27   }
28   chdir $startdir;
29   }
30 +
31 + sub copydir
32 +   {
33 +   my $src=shift;
34 +   my $dest=shift;
35 +  
36 +   use DirHandle;
37 +   use File::Copy;
38 +  
39 +   # print "Copying $src to $dest\n";
40 +   adddir($dest);
41 +   my $dh=DirHandle->new($src);
42 +  
43 +   if (defined $dh)
44 +      {
45 +      my @allfiles=$dh->read();
46 +  
47 +      my $file;
48 +      foreach $file ( @allfiles )
49 +         {
50 +         next if $file=~/^\.\.?/;
51 +         if ( -d $src."/".$file )
52 +            {
53 +            copydir($src."/".$file,$dest."/".$file);
54 +            }
55 +         else
56 +            {
57 +            copy($src."/".$file,$dest."/".$file);
58 +            }
59 +         }
60 +      undef $dh;
61 +      }
62 +   else
63 +      {
64 +      die "Attempt to open a non-existent directory ($src). Exitting\n";
65 +      }
66 +   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines