psftp put
fails about one percent of the time with example being
local: unable to open d:\\WorkPath\\F_56MTV56201504201707224380.csv
The only thing I can see doing different at this point is using lcd command with local filename and not using fully qualified path but in theory, this shouldn't change anything or am I missing something?
Example batch file:
"D:\\Program Files\\ApplicationPath\\psftp.exe" ^
1.2.3.4 -l username -pw password -batch -bc ^
-b "d:\\\\WorkPath\\\\\EXMSP35201504210946233890.script" ^
> "d:\\\\WorkPath\\\\\EXMSP35201504210946233890.script.log" 2>&1
Example script file:
put d:\\\\WorkPath\\\\EXMSP35201504210946233890.csv
bye
The D: looks like a physical disk attached to the server, however, the server, 2008R2 is on a VMWare Virtual Platform.
Use some WinAPI logger to find out, why an underlying CreateFile
WinAPI function call is failing.
Or use a different SFTP client with more detailed error messages.
For example, an equivalent WinSCP script is:
winscp.com /command ^
"option echo on" ^
"open sftp://username:[email protected]/" ^
"put d:\WorkPath\EXMSP35201504210946233890.csv" ^
"exit" > d:\WorkPath\EXMSP35201504210946233890.script.log
With WinSCP you'd get an error like:
File or folder 'd:\WorkPath\EXMSP35201504210946233890.csv' does not exist.
System Error. Code: 3.The system cannot find the path specified.
See an introduction to WinSCP scripting.
(I'm the author of WinSCP)
You should not be using double backslashes in paths. Though Windows tolerate that.