Possible Bug? Psftp does not get all files specified in a batch file when used with perl

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I'm new to psftp. I'm using psftp: Release 0.58 and perl, v5.8.7 built
for MSWin32-x86-multi-thread Binary build 813 [148120] provided by
ActiveState http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun  6 2005 13:36:37

I need to get couple of files that match a particular pattern (which is
specified in a batch file) using a perlscript, which is copied in part
from Perlscript:
   system("\"$SFTP\" -pw $pass -b $batch -be -bc $server");

command line echo of the above command:
C:\temp>c:\putty\psftp.exe -pw abc123 -b batch.txt -be -bc

the contents of the batch file are as under:

##batch file
lcd c:\logs\intranet.abcd.com
cd /web/logs/intranet.abcd.com
get server*oct*9*
get server*oct*8*
get server*oct*7*
get server*oct*6*
get server*oct*5*
get server*oct*4*
get server*20051009*
get server*20051008*
get server*20051007*
get server*20051006*
get server*20051005*
get server*20051004*
get log.log
##end of batch file

At the time of running the get command through perl, my server has only
one file of interest in the remote directory (log.log). My assumption
is that psftp should attempt to pattern match all the lines in the
batchfile and get me the log.log from my unix server. However, it does
not. See the following output:

C:\temp>perl eCommerce_move_logs.pl
logging into web@
Using username "web".
Remote working directory is /usr/local/web
psftp> lcd c:\logs\intranet.abcd.com
New local directory is c:\logs\intranet.abcd.com
psftp> cd /web/logs/intranet.abcd.com
Remote directory is now /web/logs/intranet.abcd.com
psftp> pwd
Remote directory is /web/logs/intranet.abcd.com
psftp> dir
Listing directory /web/logs/intranet.abcd.com
drwxrwxrwx    4 web web     1024 Oct  9 09:01 .
drwxrwxrwx  130 ftp      web     4096 Oct  3 12:25 ..
drwxr-xr-x    2 web web     6144 Oct  9 06:06 archive
drwxr-xr-x    2 web web     2048 Oct  9 06:06 awstats
-rw-r--r--    1 web web    19733 Mar 18  2005 foo1
-rw-r--r--    1 web web     8065 Mar 18  2005 foo2
-rw-r--r--    1 web web       13 Oct  9 09:01 log.log
psftp> get server*oct*9*
/web/logs/intranet.abcd.com/server*oct*9*: no such file or directory
psftp> get server*oct*8*
/web/logs/intranet.abcd.com/server*oct*8*: no such file or directory
psftp> get server*oct*7*
/web/logs/intranet.abcd.com/server*oct*7*: no such file or directory
psftp> get server*oct*6*


If I try again, say immediately in couple of seconds, psftp does not
even attempt to go through the first get command. Looks like some form
of caching is happenng here.

How do I force psftp to go through all commands from the batch file? I
tried arguement -be and that seem to have no effect.


Site Timeline