use File::Find; my $command="cp"; my $target="/home/kiruthika/Technical/NEW/"; #Here mention your directory path to where you need to copy the files. my $str; find(\&wanted,(".","..",)); sub wanted() { if(/.*\.txt/)#find the .txt files and copy those into another location. { $str=$command." ".$_." " .$target; system("$str"); $str=" "; } }