use File::Find;
use File::Basename;
use File::Copy;
use File::Path;

 
my $fname,$oldir,$target,$source,$newdir;
 
# 第二個參數是要開始的目錄
find(\&search, "\/release"); 
mkpath("\/release1", 1, 0777); 


sub search {   
    	
    if (/\b-src\b/i){    
       #print "$File::Find::name\n";
       $source = $File::Find::name; 
       $oldir = $File::Find::dir;
       $newdir = $oldir ;  
       $fname = $_ ; 
       $newdir =~ s/release/release1/;
       $target = $newdir . "/". $fname ; 
               
       print "$source ==> $target \n"; 
       	 
         
       mkpath($newdir,1, 0777);
       copy ($source,$target) ;  
       unlink ($source) ; 
               
    }
 }
