1.

Solve : FTP Dated File?

Answer»

You are right foxdrive. I can only say I am sorry about that but I did not know all of the requirements at my first post. I found out more and added it to my post later. I also figured out that like Salmon Trout said windows has no built in mechanism for establishing an SFTP connection so a third party application will be needed.

I want to thank everyone for your help. WinSCP looks like the answer. I think this can be mark this as solved.
I have been fooling around with the command line application which is bundled with WinSCP. It's called WinSCP.com and is located in the WinSCP PROGRAM folder. I didn't think 64 bit Windows could run .com files, but maybe that's only if they are written to run under MS-DOS command.com. Anyhow, I have managed to upload files to an sftp server on my phone.

Here is a batch file that worked. The carets ^ are batch line continuation CHARACTERS, the part STARTING "C:\Program Files (x86)\WinSCP\winscp.com" is in fact just one line, I laid it out like this to make it look neater. You have to indent the line after a ^ by at least 1 character. You see how to escape quote marks within a WinSCP command by doubling them.

The server is on my LAN, I haven't got a remote one to try.

I have munged my username and password!

Batch script
@echo off
set user=whateveruser
set password=whateverpassword
set uploadhost=192.168.0.7
set sftpport=2222
set destfolder=/storage/D952-14E6/upload/
"C:\Program Files (x86)\WinSCP\winscp.com" ^
/command "open sftp://%whateveruser%:%whateverpassword%@%uploadhost%:%sftpport%%destfolder%" ^
"put ""d:\test\upload files\test1.txt""" ^
"exit"

WinSCP.com output
Searching for host...
Connecting to host...
Authenticating...
Using username "whateveruser".
Authenticating with pre-entered password.
Authenticated.
Starting the SESSION...
Session started.
Active session: [1] [emailprotected]
Using configured transfer settings different from factory defaults.
d:\...\test1.txt | 8 B | 0.0 KB/s | binary | 100% Quote from: Salmon Trout on June 26, 2016, 02:09:21 PM

WinSCP.com and is located in the WinSCP program folder.

The file has an exe structure and is renamed as a .com file, and I suspect it's a stub that calls winscp.exe in the same folder.

The sneaky so and so's.

Your code should help those that need sftp. It's not something I've had a need for yet...


Discussion

No Comment Found