use strict; use warnings; use diagnostics; my $from = "path/to/directory/*.cmd"; my $to = "path/to/new/directory/"; `cp $from $to` or die "Copy failed: $!";