The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-19-2007
scottzx7rr scottzx7rr is offline
Registered User
 

Join Date: Aug 2007
Posts: 9
Having a problem with a FTP Script using perl

Hello All,

I have a problem that has me stumped. I am using perl to do some ftp'ing of files. I have the script in place on another environment that is functioning flawlessly. But after tweaking it to the new environment I can't get it to function. I have a search string that searches for the file name and then executes the file and deletion of that file after the ftp. The only difference between the two environments is the file name is slightly different. Any help would be greatly appreciated. I use a XML file that contains the host information. I have included the following information:

Functioning Environment:
File Defination:file.serv1.YYYYMMDDhhmm-[0-9]{4}.log
File name: file.serv1.200712192300-0500.log

XML File Info:
<host_list hostname="serv1" althostname="" username="ftpuser" password="passwd">
<file_list>
<remote_dir>/app/logs</remote_dir>
<local_dir>targetlocation/targetdirectory</local_dir>
<remote_name>file.serv1.YYYYMMDDhhmm-[0-9]{4}.log</remote_name>
</file_list>

FTP PERL File:

$searchFilter = $remoteName."\$";
$searchFilter =~ s/YYYYMMDDhhmm/[0-9]{12}/;

@files = sort grep (/$searchFilter/, @files);

Non-Functioning Environment:
File Defination: fileYYYYMMDD.log
File name: file20071219.log

XML File Info:
<host_list hostname="serv1" althostname="" username="ftpuser" password="passwd">
<file_list>
<remote_dir>/app/logs</remote_dir>
<local_dir>targetlocation/targetdirectory</local_dir>
<remote_name>fileYYYYMMDD.log</remote_name>
</file_list>

FTP PERL File:

$searchFilter = $remoteName."\$";
$searchFilter =~ s/YYYYMMDD/[0-9]{8}/;

@files = sort grep (/$searchFilter/, @files);


Any Ideas?

Thanks in Advance.

Last edited by scottzx7rr; 12-19-2007 at 01:43 PM.
Reply With Quote
Forum Sponsor