Topic "copy a file from a windows machine to a linux machine"

Author Message
kmcguine

Guest


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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Use:
"put C:\Users\tuxadm\psft\pt\8.51\appserv\prcs\PSNTDEV\log_output\SQR_CNXMF017_2435611\CNXMF017_2435611*.PDF /home/psoft/psreports/devcop/"
_________________
Martin Prikryl
Guest




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/"


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




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


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/"


prikryl wrote:
Use:
"put C:\Users\tuxadm\psft\pt\8.51\appserv\prcs\PSNTDEV\log_output\SQR_CNXMF017_2435611\CNXMF017_2435611*.PDF /home/psoft/psreports/devcop/"
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
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.
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
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 Prikryl
Dennisdr

Guest


kmcguine wrote:
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
Very Happy


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

Guest


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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
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/ui_generateurl#script
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