Bama_Perl has asked for the wisdom of the Perl Monks concerning the following question:
So, the directory list is set as an array, @tablea, and each directory is called $dir. If the file w/ extension *.txt exists, mv the $out file (within that directory) to the new directory, $newdir. Repeat the check for each directory. If run this script, nothing gets sent to new directory, so I was wondering how I could improve this script so that this script runs correctly? Thanks.#!/usr/bin/perl use warnings; $out = "outFile"; $newdir = $newdirectory; open(TABLEA, "dirlist"); @tablea = <TABLEA>; foreach $dir (@tablea) { chdir $dir; if (glob("*.txt")) { system("mv $out $newdir"); } }
|
|---|