in reply to Re^2: Check if file exists in multiple directories
in thread Check if file exists in multiple directories
Hi Bama_Perl,
What I don't understand is do you want the file "outFile" moved or copied? Because, if you move it to say the first directory that has '*.txt', what happens to another say "fourth" directory that also has '*.txt'?
Secondly, I think you should be using a perl core module like File::Copy to achieve your aim instead of using mv command in system like you are doing.
Third, you may use File::Find module to do the searching of directories for you.
Lastly, use three arguments open function and a lexical scoped file-handler (this is an old wisdom that still holds true in a way today)
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
In Section
Seekers of Perl Wisdom