Use pscp to push chosen file to a linux server

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

Use pscp to push chosen file to a linux server

Post by dark green »

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: 13274
Joined: 06 Feb 2011 00:33

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

Post by highend »

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

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

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

Post by dark green »

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: 13274
Joined: 06 Feb 2011 00:33

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

Post by highend »

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

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

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

Post by dark green »

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: 13274
Joined: 06 Feb 2011 00:33

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

Post by highend »

The "Action on click" must be set to "Go to Location"
One of my scripts helped you out? Please donate via Paypal

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

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

Post by dark green »

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

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

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

Post by highend »

Just seen it. Thanks! :beer:
One of my scripts helped you out? Please donate via Paypal

Post Reply