1753455 Members
6094 Online
108794 Solutions
New Discussion юеВ

sftp in batch ?

 
SOLVED
Go to solution
rmueller58
Valued Contributor

sftp in batch ?

I've been using SCP to transfer files internally for sometime, I have a file I need to push out to a vendor,

I was hoping I could use the similar command

sftp -b filename -o port=port# user@remote:

the file is not transmitting.


Doesn't the SFTP command work similarly to SCP?

Any insight on how to push the file in batch would be appreciated..

R
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor
Solution

Re: sftp in batch ?

Hi Rex:

See my suggestion (an example) here:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1195325

Regards!

...JRF...
Mounaam
Trusted Contributor

Re: sftp in batch ?

Hi,

what is the content of your batchfile "filename"?

You can try:
$ echo 'put myfile' | sftp -b - -o port=port# user@remote
or
$ echo 'put myfile' > batch
$ sftp -b batch -o port=port# user@remote

Regards,
Mounaam
rmueller58
Valued Contributor

Re: sftp in batch ?

Thanks guys.

James R. Ferguson
Acclaimed Contributor

Re: sftp in batch ?

Hi (again) :

Another script of mine is here:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1353692

Regards!

...JRF..

rmueller58
Valued Contributor

Re: sftp in batch ?

JRF,

I have done the public key exchange, I was hoping to be able to a single command line like I do with SCP.

Oh the joy!!

rmueller58
Valued Contributor

Re: sftp in batch ?

Thanks guys.. got it.

solutions was:

Public key exchange and :


sftp -o port=port# user@hostname<lcd /localdir
put file

rmueller58
Valued Contributor

Re: sftp in batch ?

Thanks