Topic "remote copy command?"

Author Message
stevec5088
[View user's profile]

Joined: 2012-08-30
Posts: 2
Location: WhitneyZone.com
I need to streamline an automated Winscp session, where the session connects to the remote server, and copies one file over another. It is similar to the mv command, but I don't want to destroy the original file.

I've tried issuing: call cp file1 file2

but that returns the error: "500 CP not understood" Note the CP is changed to uppercase.

It appears the interactive WinSCP process has a "duplicate" process, but I cannot seem to find a way to remotely make a copy of a file using a batch script.

I sure hope someone can help. I will appreciate the help.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
I do not think FTP has command to duplicate remote file.
In GUI with FTP protocol, WinSCP duplicates the remote file via temporary local copy.
_________________
Martin Prikryl
stevec5088
[View user's profile]

Joined: 2012-08-30
Posts: 2
Location: WhitneyZone.com
Thank you, Martin, for the help.

It appears WinSCP is still working the same as FTP on the remote server, so no new capabilities... is that correct? If so, too bad.

I am not very familiar with unix, so I somehow thought the "call" command could be issued to run the remote cp.

What am I missing?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
stevec5088 wrote:
I am not very familiar with unix, so I somehow thought the "call" command could be issued to run the remote cp.

With FTP protocol the "call" command executes raw FTP protocol commands.
Some FTP servers have commands to execute arbitrary shell commands, such as "site exec <shell_command>".
See also:
http://winscp.net/eng/docs/remote_command
_________________
Martin Prikryl
cprasad111
[View user's profile]

Joined: 2012-09-25
Posts: 5
Location: singapore
I have a script in unix that i use to run task in windows by remote invoking
eg(command written in unix): myscript windows_IP_address "command to be executed"
eg of "command to be execute": d:\\a.cmd or echo d:\\a.txt etc. and it works

similarly i want to invoke and run winscp the same way and transfer file from windows to unix
what i tried:
$ myscript windows_IP_address 'd:\\blah\\blahWinSCP.com unix_user@unix_IP /hostkey "sh-rsa 1024 xx:xxx:xx:xx" /command put "d:\\blah\\blah\\a.txt" /tmp/blah/a.txt'

$ myscript windows_IP_address 'd:\\blah\\blahWinSCP.com unix_user@unix_IP -hostkey="sh-rsa 1024 xx:xxx:xx:xx" /command put "d:\\blah\\blah\\a.txt" /tmp/blah/a.txt'

$ myscript windows_IP_address 'd:\\blah\\blahWinSCP.com unix_user@unix_IP /privatekey "address ofprivate key" /command put "d:\\blah\\blah\\a.txt" /tmp/blah/a.txt'

i have tried all the combinations of the combinations of private key and hostkey

this works from windows: d:\\blah\\blahWinSCP.com unix_user@unix_IP /command put "d:\\blah\\blah\\a.txt" /tmp/blah/a.txt <<where the private key is taken from pageant; but in unix i have to provide the private key file location>>


the same syntax work for Putty, there the key is given by the token: -i "address of primary key file"

is there any way to give the address of private key file or hosteky or anything that can work
cprasad111
[View user's profile]

Joined: 2012-09-25
Posts: 5
Location: singapore
....SOLVED....

after trying some permutations and combinations of the syntax given in the documentation, I was able to specify the private key file location in the command line itself. And it ran successfully. No need to specify the hostkey (atleast in my case). The code was tested while pageant of putty was off to prevent taking the private key from there.

The command was written in windows command prommpt
winscp.com user@server_ip_address /command put readme.txt /path/path1/readme.txt /privatekey=path_of_private_key\mani.ppk

The command was written in unix machine
my_script_to_invoke_window_jobs windwo_ip_address 'path_of_winscp.com\\WinSCP.com user@unix_ip_address /command "put path_of_file_in_windows\\r.txt /path_of_file_in_unix/t.txt" /privatekey=path_of_private_key\mani.ppk'
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