1

In my batch file I have the following code:

cd /D "C:\Putty.0.63"
psftp -b D:\batch\psftp.txt user@ftp.server.com -pw myPassword

pause

psftp.exe is in the C:\Putty.0.63 location.

In psftp.txt I have open ftp.server.com

I can log in to the ftp server but I don't know how to put a file. I tried to put cmd in the batch file or the textfile, but nothing works. Looks like I can't do put inside a batch file.

Any ideas?


Solved:

In psftp.txt I had : open ftp.server.com put myFile.sql to make it work I removed the first line and just left the put myFile.sql in the file. I didn't need the open ftp.server.com because i was already opening the connection in the batch file with user@ftp.server.com -pw myPassword

ramsey_lewis
  • 558
  • 8
  • 25

1 Answers1

1

You are opening a connection twice:

  1. On psftp command-line using user@ftp.server.com -pw myPassword
  2. In script file using open ftp.server.com.

The open command fails, as you are already connected. So the put command never executes.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992