Use pscp to push chosen file to a linux server

Discuss and share scripts and script files...
dark green
Posts: 5
Joined: 15 Jul 2017 08:00

Use pscp to push chosen file to a linux server

Postby dark green » 31 May 2018 18:15

Something I have to do many times per day is move python files to a linux machine to run.

if $FILE is the chosen file the command I use for this is

Code: Select all

pscp $FILE username@192.168.1.101:directoryname


doing this does require me to enter a password at the command line

Can I set this up as a catalog item for drag and drop? Or alternately as a right-click option?

I tried this as a script for the catalog:

Code: Select all

C:\Program Files\PuTTY\pscp.exe <curname> username@192.168.1.101:directoryname


But it doesn't work and when I try running it as a raw script I get "Overflow 0/0"

I think there's something fundamental I am misunderstanding. Can I use the catalog items to run a command line?

highend
Posts: 7448
Joined: 06 Feb 2011 00:33

Re: Use pscp to push chosen file to a linux server

Postby highend » 31 May 2018 18:44

Code: Select all

run """C:\Program Files\PuTTY\pscp.exe"" ""<curitem>"" ""username@192.168.1.101:directoryname""";
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

dark green
Posts: 5
Joined: 15 Jul 2017 08:00

Re: Use pscp to push chosen file to a linux server

Postby dark green » 31 May 2018 18:50

Hi highend. That looks very promising. Doesn't run as a catalog item, can you tell me where you intend that to be used?

highend
Posts: 7448
Joined: 06 Feb 2011 00:33

Re: Use pscp to push chosen file to a linux server

Postby highend » 31 May 2018 18:53

Mh, it runs as a catalog item here (drag and drop)?

Show a screenshot of the properties of this entry in the catalog...

Apart from that, for multiple files at once:

Code: Select all

    $items = replace(<selitems>, '"', '""');
        run """C:\Program Files\PuTTY\pscp.exe"" $items ""username@192.168.1.101:directoryname""";
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

dark green
Posts: 5
Joined: 15 Jul 2017 08:00

Re: Use pscp to push chosen file to a linux server

Postby dark green » 31 May 2018 19:03

I'm probably missing something you would consider obvious. At my end I can't even drag a file onto the catalog item, it gives the line-through-circle indicating it isn't a valid operation. Here is an image of the properties.

Image

highend
Posts: 7448
Joined: 06 Feb 2011 00:33

Re: Use pscp to push chosen file to a linux server

Postby highend » 31 May 2018 19:56

The "Action on click" must be set to "Go to Location"
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

dark green
Posts: 5
Joined: 15 Jul 2017 08:00

Re: Use pscp to push chosen file to a linux server

Postby dark green » 31 May 2018 20:03

Okay, I got it running. Thanks!
Update: Also, I sent Paypal to you, thanks for the help!

highend
Posts: 7448
Joined: 06 Feb 2011 00:33

Re: Use pscp to push chosen file to a linux server

Postby highend » 31 May 2018 21:07

Just seen it. Thanks! :beer:
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de


Return to “Script Exchange”



Who is online

Users browsing this forum: No registered users and 1 guest