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

From: sprathapa (sprathapa_at_gmail.com)
Date: 10/09/05


Date: 9 Oct 2005 10:01:11 -0700

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
below:
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
web@192.168.2.1

the contents of the batch file are as under:

##batch file
lcd c:\logs\intranet.abcd.com
cd /web/logs/intranet.abcd.com
pwd
dir
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
quit
##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@192.168.2.1.
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.

Thanks.



Relevant Pages

  • task scheduler and bach files running
    ... I just finished writing a batch file that will psftp (secure ftp ... client) a file from a Linux machine to a windows machine, ... I run this batch file from the command line it works perfectly, ...
    (microsoft.public.win2000.cmdprompt.admin)
  • psftp not setting errorlevel
    ... Running psftp in a batch file under Win/XP with the -b ... Users running the batch file don't notice the error message, ... errorlevel, the batch file doesn't know it should do something to attract ... The return code is zero even if the file of commands is ...
    (comp.security.ssh)
  • PSFTP running as a Scheduled Task under WinXp
    ... I have PSFTP called from a batch file to login in to an SFTP server ... and download 4 files. ... PSFTP and the batch file reside. ... The scheduled task has the "Start In" directory set correctly and runs ...
    (comp.security.ssh)
  • psftp and mkdir
    ... im writing a script that will backup my work to my uni server via ... batch file, and I'm using psftp with command line arguments. ...
    (comp.terminals)
  • Re: Putty PSFTP hangs on bad username/password?
    ... don't have any other SFTP servers to connect to so I'm at a big disadvantage ... If I try to access a server and have the username/password wrong, PSFTP ... If I hit ^C it will terminate. ... The command line I'm using is simply ...
    (comp.security.ssh)