|There's more than one way to do things|
Perl sftp behavior when there are no files in the shareby Bindo (Acolyte)
|on Mar 21, 2013 at 10:14 UTC||Need Help??|
Bindo has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings Good people..!
I'm a beginner who just joined this community with lots of hopes. With much attempt I've written a script whcih does the following.
1. Will create a directory under “/x01/xx/xx/xx” by the current date, in the format of “YYYYMMDD” if it has not already been created. i.e: if the script is run on “01st of jan 2013”, the directory “20130101” will be created under the said path. So whenever there is a need to inspect the logs always look for a directory by the current date. i.e: if the script is run on “01st of jan 2013”, the directory “20130101” will be created under the said path. So whenever there is a need to inspect the logs always look for a directory by the current date.
2. Check if the log file(s) have already been downloaded earlier within the same day, and if not log(s) will be downloaded to the TODAY’s directory.
As you see on the subroutine "get_LOGS" I'm terminating the script if there are no files can be found on the server. Can someone go through the script and let me know what I should do to return a message saying that there are no files in the server? For an instance if I specify 2 or more files to be downloaded that are not really on the remote share, it would just complain about the first file and exit.(I know this is because of the die function, its just that I have no idea how to address such a scenario
Usage of the script: abc_logs.pl <file1> <file2>..file(n))
PLease help out gentlemen. This will solve lots of other doubgts that I have when it comes to perl subroutines.