How do I copy particular extension files recursively and store it in same folder structure?
Code:
use strict; use warnings; my $pwd = "/home/ra/DEMO"; my $destination = "/home/ra/output"; opendir(DIR, "$pwd") or die "Error"; my @files = readdir(DIR); closedir(DIR); foreach my $file ( @files ) { next if ($file !~ /\.config$/i); # filtered only file with extension .config system(`cp "$pwd $file" "$destination"`); }