Hi All, I put togather few lines of code, I am looking to achieve the below
dir1 with file1, file2 dir2 with file1, file2 i want to copy the files from each of the directory to a third directory dir3 as file1, file2 from dir1 and rename the file1 as file3 and file2 as file4 from the dir2. dir3 with file1,file2,file3,file4 Please let me know how to modify the below to achieve this. Thanks in advance #!/usr/bin/perl -w # dir1 with file1, file2 # dir2 with file1, file2 # copy inot dir3 list of files file1, file2, file3, file4 use strict; use warnings; my @files; my $file; my $dir = "/work/dir1"; opendir (DIR, $dir); @files = readdir(DIR); closedir(DIR); print "@files \n"; foreach $file (@files) { print "$file \n"; } my @files1; my $file1; my $num1=1; my $dir1 = "/work/dir2"; opendir (DIR, $dir1); @files1 = readdir(DIR); #closedir(DIR); foreach $file1 (@files1) { print "$file1.$num1 \n"; system "(mv $file1 $file1.$num1"); } closedir(DIR); Thanks, Sj