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.7 by sashby, Fri Dec 10 13:41:43 2004 UTC vs.
Revision 1.8 by sashby, Wed Feb 2 11:10:18 2005 UTC

# Line 64 | Line 64 | sub copydir
64        die "Attempt to open a non-existent directory ($src). Exitting\n";
65        }
66     }
67 +
68 + sub copydirwithskip
69 +   {
70 +   my $src=shift;
71 +   my $dest=shift;
72 +   my ($filetoskip)=@_;
73 +  
74 +   use DirHandle;
75 +   use File::Copy;
76 +  
77 +   adddir($dest);
78 +  
79 +   my $dh=DirHandle->new($src);
80 +  
81 +   if (defined $dh)
82 +      {
83 +      my @allfiles=$dh->read();
84 +  
85 +      my $file;
86 +      foreach $file ( @allfiles )
87 +         {
88 +         next if $file=~/^\.\.?/;
89 +         # Skip backup files and x~ files:
90 +         next if $file =~ /.*bak$/;
91 +         next if $file =~ /.*~$/;
92 +
93 +         if ($file eq $filetoskip)
94 +            {
95 +            next;
96 +            }
97 +        
98 +         if ( -d $src."/".$file )
99 +            {
100 +            copydir($src."/".$file,$dest."/".$file);
101 +            }
102 +         else
103 +            {
104 +            copy($src."/".$file,$dest."/".$file);
105 +            if ( -x $src."/".$file || -X $src."/".$file ) {chmod(0775,$dest."/".$file);}
106 +            }
107 +         }
108 +      undef $dh;
109 +      }
110 +   else
111 +      {
112 +      die "Attempt to open a non-existent directory ($src). Exitting\n";
113 +      }
114 +   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines