Hi,
I would like to know how to copy certain types of files from a group of directories into another group of directories.
I would like to know how to copy certain types of files from a group of directories into another group of directories.
use strict;
use warnings;
use File::Copy;
use File::Glob;
my $Src_Dir = 'C:\Documents and Settings\abcd';
my $Dest_Dir_Gel = 'C:\gel';
my $Dest_Dir_Res = 'C:\Results';
Sub dir_read
{
# parse directory and sub directories for files
# Declarations
my @Dir_List;
my @Gel_List;
my @Res_List;
my $Dir_Name = $_[0];
# Create directories with module name
mkdir "$Dest_Dir_Gel\$Dir_Name";
mkdir "$Dest_Dir_Res\$Dir_Name";
foreach (@Dir_List){
opendir(cDIR, $Dir_Name);
# List the .gel and .res files
@Gel_List = <*.gel>;
@Res_List = <*.res>;
#copy files to folder
foreach (@Gel_List){
copy($_,"$Dest_Dir_Gel\$Dir_Name");
}
#copy files to folder
foreach (@Res_List){
copy($_,"$Dest_Dir_Res\$Dir_Name");
}
closedir(cDIR);
}
}
&dir_read($Src_Dir);
my $Dir_Name = $_[0];
mkdir "$Dest_Dir_Gel\$Dir_Name";
Comment