$inputFileName = $ARGV[0]; $inputFilewithPath = $ARGV[1]; $destinationFileName = ""; $destinationFilePath = "\\mftshare-dev\Test\customoutput\Test1"; $triggerFileName = ""; my @zipfiles = glob "\\mftshare-dev\cpa\customoutput\hubidp\*.zip"; for my $file (@zipfiles) { if ($inputFileName =~ /alphat_(.*)\.zip/) { my $key = $1; # whatever was between alphat_ and the .zip bits. if (-f "numerict_${key}.zip" && -f "updatet_${key}.zip") { $destinationFileName = sprintf("%s%s%s", $destinationFilePath, $inputFileName); $triggerFileName = sprintf("%s%s%s", $destinationFilePath , "cpa_trigger.done"); $returnVal = system("ftmscmd /tcp /send /file /node:VIP /DT:B /CrLf:Y /ppa1:S,L,COMMAND,\"echo > $triggerFileName\" /TC:3 $inputFilewithPath $destinationFileName"); } else { printf "WARNING: EXPECTED FILES NOT FOUND. INVESTIGATION REQUIRED"; exit 8; } } }