How to automate file upload without using saved session?

Advertisement

freedom_nut
Guest

How to automate file upload without using saved session?

Hello,

Complete beginner here. My server is generating text files and needs to send them to a WinSCP site. This will be part of an automated task, and since a session is saved in a user folder [I'm told], we don't want to refer to a session file. Therefore, I'd like to execute the upload in one line at the command prompt. Could somebody please show me a basic method of doing so? I've duplicated some of the commands found here in the forums and have had no luck. Come to think of it, I haven't been able to connect any way other than using the WinSCM.exe app, which won't work for automation.

Much thanks,
Eric B.

Reply with quote

Advertisement

Guest

That page helps somewhat. It doesn't tell a beginner how to fire up a command prompt and connect from there, which I figure is the best way for me to start. Simply making a successful connection to the SFTP server would be a success at this time.

I've tried, from the command prompt:
"C:\Program Files (x86)\WinSCP\WINSCP.com"

And that runs successfully. I can tell it is because the next line prompts me with "winscp>".

So I next typed in:
open MyUserAcct:MyPassword@sftpservername.ourdomain.com

I assume the command is valid, because the screen then read "Searching for host...."

However, the very next line is "Network error: Connection timed out."

I know the user name and password are good. I'm able to log in at sftpservername.ourdomain.com using that login and password.

What gives? Why can't I connect from the command line?

Reply with quote

Guest

Also, I'm not able to connect using the WinSCP Login app. I've created a session:

host name: sftpservername.ourdomain.com
Port number: 22
User name: MyUserAcct
Password: MyPassword
File protocol: SFTP
Allow SCP fallback = True (doesn't work as "false", either)

That doesn't work. I get a "Network connection error: timed out" message about every 30 seconds when trying to Login.

The only successful connection I get is using IE, for some reason.

Reply with quote

Guest

OK, got connected. I had to use a separate machine from my local one, though, not sure why. Here's what is working for me, from the command prompt (all one line):

"C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /command "option batch on" "option confirm off" "open MyUserAcct:MyPassword@sftpservername.ourdomain.com" "put c:\users\me\desktop\testfile.txt"

Now that I have a successful connection, I can start working on the idiosyncracies.

Thanks for the link, prikryl.

Reply with quote

Advertisement

You can post new topics in this forum