-1

I´m trying to upload a file to a server using PSFTP, a script is generated automatically using batch scripting, the psftp is called at the batch script. But the file is not being uploaded and no errors are shown.

FTP Script:

lcd C:\files
cd / 
put file.txt    
exit

FTP log:

New local directory is C:\files
Remote directory is now /
local:file.txt => remote:/

As you can see at the FTP log the remote is empty and the file is not transferred. But if we do the same commands manually (not executed in a batch script) the file is transferred correctly.

Please help us to find the root cause of this.

  • What happens after the `local:file.txt => remote:/`? Does `psftp` hang or exit? What if you add another command, like `ls`? – Martin Prikryl Feb 01 '16 at 14:09
  • Hi Martin, thanks for answering. I have added the ls command, and the command is executed, but the file to be trasnferred is not shown, confirming that the file is not transferred – Ricardo Sanches Feb 01 '16 at 14:29
  • Can you show us screenshots of the console window for both the script test and manual test? Including the `ls` command? – Martin Prikryl Feb 01 '16 at 14:34
  • Currently I´m not able to execute the commands manually, but basically the difference between sending the files manually and at the batch script is the next line: at batch script "local:file.txt => remote:/" (file not transferred), executing manually "local:file.txt => remote:/file.txt" (file transferred) , I will include the screenshots once I´m able to perform the commands – Ricardo Sanches Feb 01 '16 at 15:28
  • Did you try another SFTP client? For example with WinSCP you can do: `winscp.com /command "open sftp://username:password@example.com/" "lcd C:\files" "cd /" "put file.txt" "exit"` – Martin Prikryl Feb 01 '16 at 15:34
  • Or you can actually use your psftp script like `winscp.com /script=c:\path\to\psftp.txt` (where `psftp.txt` is your "FTP script"). – Martin Prikryl Feb 01 '16 at 15:35
  • Hi all, we identified the root cause of the issue, the problem was caused by the psftp version while trying to call the ftp script: "psftp -b ". So we only downloaded the latest psftp version, and now the file is transferred correctly. – Ricardo Sanches Feb 01 '16 at 16:55

1 Answers1

0

The problem was caused by the psftp version, while trying to call the ftp script: "psftp -b ".

So we only downloaded the latest psftp version, and now the file is transferred correctly.