Hi,

I am trying to use psftp to get a list of remote files. The problem is
that it seems like psftp returns ERRORLEVEL = 1 regardless of a
success or failure. I am on Windows Server 2003 R2 Enterprise
Edition.

Any ideas?

psftp logs below

H:\>D:\SFTP\psftp.exe [IP Address] -be -l amp.vetting -i D:\SFTP\keys
\ampmqgwd0
1v_private_key.ppk -b E:\ICC\Script\psftp_batch_augwy_edw_fps3
_vettingdata.bat
Using username "blah".
Remote working directory is /
New local directory is E:\ICC\Transfers\AUGWY_EDW_FPS3_VETTINGDATA
remote:/test_results/VettingExportFTP_2007-11-28_10-01-44.txt =>
local:
VettingExportFTP_2007-11-28_10-01-44.txt
remote:/test_results/VettingExportFTP_2007-11-28_10-03-20.txt =>
local:
VettingExportFTP_2007-11-28_10-03-20.txt
remote:/test_results/VettingExportFTP_2007-11-28_10-15-16.txt =>
local:
VettingExportFTP_2007-11-28_10-15-16.txt
remote:/test_results/VettingExportFTP_2007-11-28_10-48-14.txt =>
local:
VettingExportFTP_2007-11-28_10-48-14.txt
remote:/test_results/VettingExportFTP_2007-11-28_10-48-32.txt =>
local:
VettingExportFTP_2007-11-28_10-48-32.txt
remote:/test_results/VettingExportFTP_2007-11-28_10-49-03.txt =>
local:
VettingExportFTP_2007-11-28_10-49-03.txt
remote:/test_results/VettingExportFTP_2007-11-28_10-50-27.txt =>
local:
VettingExportFTP_2007-11-28_10-50-27.txt
remote:/test_results/VettingExportFTP_2007-11-28_10-51-25.txt =>
local:
VettingExportFTP_2007-11-28_10-51-25.txt
remote:/test_results/VettingExportFTP_2007-11-28_20-01-00.txt =>
local:
VettingExportFTP_2007-11-2

8_20-01-00.txt
/test_results/VettingExportFTP_2007-11-28_10-01-44.txt -> /archive//
Vet
tingExportFTP_2007-11-28_10-01-44.txt
/test_results/VettingExportFTP_2007-11-28_10-03-20.txt -> /archive//
Vet
tingExportFTP_2007-11-28_10-03-20.txt
/test_results/VettingExportFTP_2007-11-28_10-15-16.txt -> /archive//
Vet
tingExportFTP_2007-11-28_10-15-16.txt
/test_results/VettingExportFTP_2007-11-28_10-48-14.txt -> /archive//
Vet
tingExportFTP_2007-11-28_10-48-14.txt
/test_results/VettingExportFTP_2007-11-28_10-48-32.txt -> /archive//
Vet
tingExportFTP_2007-11-28_10-48-32.txt
/test_results/VettingExportFTP_2007-11-28_10-49-03.txt -> /archive//
Vet
tingExportFTP_2007-11-28_10-49-03.txt
/test_results/VettingExportFTP_2007-11-28_10-50-27.txt -> /archive//
Vet
tingExportFTP_2007-11-28_10-50-27.txt
/test_results/VettingExportFTP_2007-11-28_10-51-25.txt -> /archive//
Vet
tingExportFTP_2007-11-28_10-51-25.txt
/v/VettingExportFTP_2007-11-28_20-01-00.txt -> /archive//Vet
tingExportFTP_2007-11-28_20-01-00.txt
Fatal: Server sent disconnect message
type 11 (by application):
"Bye!"

H:\>echo %ERRORLEVEL%
1

-------

H:\>D:\SFTP\psftp.exe 203.30.165.50 -l amp.vetting -i D:\SFTP\keys
\ampmqgwd01v_private_key.ppk
Using username "amp.vetting".
Remote working directory is /
psftp> ls
Listing directory /
drwxrwxrwx 1 0 0 0 Feb 13 09:17 archive
drwxrwxrwx 1 0 0 0 Feb 13 09:17
safetrac_test_results
drwxrwxrwx 1 0 0 0 Feb 11 10:48 vett_interim
psftp> bye
Fatal: Server sent disconnect message
type 11 (by application):
"Bye!"

H:\>echo %ERRORLEVEL%
1

-----

The batch script contains the following commands:
lcd E:\ICC\Transfers\AUGWY_EDW_FPS3_VETTINGDATA
mget /test_results/VettingExportFTP_2007-11-28*
mv test_results/VettingExportFTP_2007-11-28* archive/
bye
----


Any help would be appreciated.

Regards
Dave