Topic "How to automate file upload without using saved session?"

Author Message
freedom_nut

Guest


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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Would this article help?
https://winscp.net/eng/docs/guide_automation
_________________
Martin Prikryl
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?
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.
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.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License