use strict; use warnings; use diagnostics; use File::Copy; my $from = "path/to/directory/*.cmd"; my $to = "path/to/new/directory/*.cmd"; copy($from, $to) or die "Copy failed: $!";