login about faq

I am using your SFTP (Secure File Transfer over SSH)

Is there a copy function in your software?

After I upload a file I want to copy it to a backup folder. Is there such a function in your SFTP software?

Obviously I can upload twice, but copying would probably be faster. We have heavy upload volume.

asked Oct 19 '15 at 08:19

chilkat's gravatar image

chilkat ♦♦
11.8k316358420


There is nothing in the SFTP protocol itself to do a remote "cp" command to copy a file from one location on the server to another.

You could use SSH run a "cp" command on the server. For example:

success = ssh.SendReqExec(channelNum,"cp filePath1 filePath2");

See: http://www.example-code.com/csharp/ssh_exec.asp
http://www.example-code.com/vb6/ssh_exec.asp

It should be possible to keep an SSH authenticated connection open for many commands. Each SendReqExec would have to occur on its own logical SSH channel. This means that for each command, one would open a new channel via OpenSessionChannel, send the command, and then receive any output via ChannelReceiveToClose.

Note: The SendReqExec is not a remote shell session. A remote shell session is a bit different, and is demonstrated here: http://www.example-code.com/vb6/ssh_multiple_commands.asp

link

answered Oct 19 '15 at 08:30

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I use this code. It works if I run "ls", but it cannot run "cp", that's why??

link

answered Jun 29 at 11:38

muggle222's gravatar image

muggle222
183

I have the same problem. Maybe it is the config of ssh server?

link

answered Aug 27 at 13:29

muggle222's gravatar image

muggle222
183

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×200
×9

Asked: Oct 19 '15 at 08:19

Seen: 623 times

Last updated: Aug 27 at 13:29

powered by OSQA