Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: I got an error specifying that Host "put C" does not exist.

You have the quotes wrong:

This should work:
winscp.com /command "open sftp://UsernameinLinuxMachine@LinuxHostname -privatekey=C:\Users\MyName\Desktop\KeyFolder\private.ppk" "put C:\DataFolder\FileToBeTransferred /users/MyLinuxUsername/Desktop/Folder1/"

Easiest is to have the command-line generated in GUI:
https://winscp.net/eng/docs/guide_automation#generating
Sam12345

I got an error specifying that Host "put C" does not exist.

Hi,
This is the first time I'm using WinSCP (GUI side is awesome) but, when I have tried to use it in command line, I'm doing a silly mistake I believe. Can you please help me with it

The following is the command I'm using
winscp.com /command "open sftp://UsernameinLinuxMachine@LinuxHostname" -privatekey=C:\Users\MyName\Desktop\KeyFolder\private.ppk "put C:\DataFolder\FileToBeTransferred /users/MyLinuxUsername/Desktop/Folder1/"

I'm getting connected to the remote system in Linux but the file isn't getting transferred. I got following statements
Searching for host...
Host "put C" does not exist.
Searching for host...
Connecting to host...
Authenticating...
Using username "myname"

I would greatly appreciate your guidance here.

Thanks&Regards
Sam
Dennisdr

Re: copy a file from a windows machine to a linux machine

@kmcguine: :D

It help us a lot in making a batch file....thank a lot
martin

Re: copy a file from a windows machine to a linux machine

Anonymous wrote:

I believe the problem may be related to winscp is running under the "system" account. I need it to run under the user I am logged into the machine as.

Do you have any suggestions?

Not sure what kind of suggestion you ask for.
martin

Re: copy a file from a windows machine to a linux machine

Anonymous wrote:

Thanks, I was having trouble where to place the quotes. After making your suggested change, I am still having trouble. I'd like to copy the entire directory. Can I do this? Do the wildcards work with the put command?
"put C:\Users\tuxadm\psft\pt\8.51\appserv\prcs\PSNTDEV\log_output\SQR_CNXPO404_2437814\*.* /home/psoft/psreports/devcop/"

You seem to have the command right.
Guest

Re: copy a file from a windows machine to a linux machine

I believe the problem may be related to winscp is running under the "system" account. I need it to run under the user I am logged into the machine as.

Do you have any suggestions?
Thanks
Guest

Re: copy a file from a windows machine to a linux machine

Thanks, I was having trouble where to place the quotes. After making your suggested change, I am still having trouble. I'd like to copy the entire directory. Can I do this? Do the wildcards work with the put command?
"put C:\Users\tuxadm\psft\pt\8.51\appserv\prcs\PSNTDEV\log_output\SQR_CNXPO404_2437814\*.* /home/psoft/psreports/devcop/"
martin

Re: copy a file from a windows machine to a linux machine

Use:
"put C:\Users\tuxadm\psft\pt\8.51\appserv\prcs\PSNTDEV\log_output\SQR_CNXMF017_2435611\CNXMF017_2435611*.PDF /home/psoft/psreports/devcop/"
kmcguine

Copy a file from a Windows machine to a Linux machine

I am trying to use a command line to copy a file from a Windows machine to a Linux machine, but I can not get to file to copy to a different directory other than the home directory. The command line I am using is:
"c:\Program Files (x86)\WinSCP\winscp.exe" /command "option batch on" "option confirm off" "open userid:password@remotelinuxmachine" "put C:\Users\tuxadm\psft\pt\8.51\appserv\prcs\PSNTDEV\log_output\SQR_CNXMF017_2435611\CNXMF017_2435611*.PDF" "cd /home/psoft/psreports/devcop/" "/log=C:\Users\tuxadm\test.log" "exit"

The script works fine except that I can't copy to /home/psoft/psreports/devcop/, it copies to /home/psoft/.

Thanks,
Karen