"get" fails - no file: Can't get attributes of file / No such file or directory. / Error code: 2
WinSCP
WinSCP: 5.17.10 (build 11087)
Windows Server 2019
SFTP
Scripting/automation
Logs with
Logs with
I tried using an
I’m on a Windows platform. We execute a bat file that calls the command lines:
Command lines with are in
This version is using
This version is using
get
fails when there is no file and doesn’t continue to the exit
command. I’m using command lines. (code listed below the examples). If I use a mget
with an *
in the file name it does end cleanly.
WinSCP: 5.17.10 (build 11087)
Windows Server 2019
SFTP
Scripting/automation
Logs with
get
:
F:\ecs>"C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /script="F:\ecs\z-GXS_test.txt" echo on open sftp:// ******:***@FTP.xxx.com/ -hostkey="ssh-rsa 1024 4Q18VXXv3xw0xCrhpJVtIhqANlUrOf924HYGORyq0LI=" -timeout=300 -rawsettings CacheDirectories=0 CacheDirectoryChanges=0 EOLType=1 Searching for host... Connecting to host... Authenticating... Using username "******". Authenticating with pre-entered password. Authenticated. Starting the session... Session started. Active session: [1] ******@FTP.xxx.com cd from_cass /from_cass get MDBDATAAA.TXT f:\edi\ediprd\xlate\mbx\ck02521\recv\don_cassmthly.txt Can't get attributes of file 'MDBDATAAA.TXT'. No such file or directory. Error code: 2 Error message from server (en): No such file. F:\ecs>
mget
:
I tried using an
mget
and is doesn’t fail when there is no file. It executes the exit
at the end.
F:\ecs>"C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /script="F:\ecs\z-GXS_test.txt" echo on open sftp://******:***@FTP.cassinfo.com/ -hostkey="ssh-rsa 1024 4Q18VXXv3xw0xCrhpJVtIhqANlUrOf924HYGORyq0LI=" -timeout=300 -rawsettings CacheDirectories=0 CacheDirectoryChanges=0 EOLType=1 Searching for host... Connecting to host... Authenticating... Using username "******". Authenticating with pre-entered password. Authenticated. Starting the session... Session started. Active session: [1] ******@FTP.xxx.com cd from_cass /from_cass mget MDBDATAAA.TXT* f:\edi\ediprd\xlate\mbx\ck02521\recv\don_cassmthly.txt No file matching 'MDBDATAAA.TXT*' found. exit F:\ecs>
z-GXS_sFTP_test.bat
:
echo on "C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /script="F:\ecs\z-GXS_test.txt"
z-GXS_test.txt
:
This version is using
get
:
option echo on open sftp://cs011900:xxxxxx@FTP.xxxxxx.com/ -hostkey="ssh-rsa 1024 4Q18VXXv3xw0xCrhpJVtIhqANlUrOf924HYGORyq0LI=" -timeout=300 -rawsettings CacheDirectories=0 CacheDirectoryChanges=0 EOLType=1 cd from_cass get MDBDATAAA.TXT f:\edi\ediprd\xlate\mbx\ck02521\recv\don_cassmthly.txt exit
mget
: