Link to home
Start Free TrialLog in
Avatar of mansur_mca
mansur_mcaFlag for United Arab Emirates

asked on

how to go "mget" in psftp as part of the batch script ? . it is not working for me .

dear experts ,

I do have batch script that use  "mget" as part of the script to get files by the psftp procedure ,
when I use this command it is showing me as an invalid command like.

then I tried with get , put it is gone thru, is there any work around for this?
how to use  as part of the script , please advise
Avatar of knightEknight
knightEknight
Flag of United States of America image

show us the relevant portion of the commands or script you are using now.  Also, run the "prompt" command before the mput or mget commands in your ftp script:

  prompt
  mget *.txt
if mget is not allowed, then you need to use get/put with a full filename
Avatar of mansur_mca

ASKER

knightEknight,
I tried as u advised by "prompt" command . but it is not went though. As you as asked about log execution , pasted below  

ahoffmann,
I do have set of 50  and more files ,  my requiremment is to  pull/push all these files by the script . as this not possible by the one-by-one process , server also only support psftp rather FTP , looking the solution how to achive this .

Dear experts,
Any advice .. pull/push mltiple  multiple files in one shot in psftp .. detail log are provided  below as that I  tried .
Even  I tried to see what are the possible commands are there by > PSFTP  HELP  , there is so such mget , mput  present or  comand which will suffice my requirement.
========================================
bility@itc.it.com's password:
Remote working directory is /itc/r21dev
psftp> cd /itc/dev/interface/upload
Remote directory is now taca/dev/interface/upload/
psftp> mget *.*
psftp: unknown command "mget"
psftp> put test.txt
local: unable to open test.txt
psftp> put file.txt
local:file.txt => remote:/itc/dev/interface/upload/file.txt
psftp> get file.txt
remote:/itc/dev/interface/upload/file.txt => local:file.txt
psftp> mget file.txt
psftp: unknown command "mget"
psftp> mput file.txt
psftp: unknown command "mput"
psftp> mget *.*
psftp: unknown command "mget"
psftp> mput file.txt
psftp: unknown command "mput"
psftp> mget *.txt

----
psftp> prompt
psftp: unknown command "prompt"
psftp>
------------------------

thanks for all ..... in advance
if your ftp client is that stupid you have to feed it with a script around which uses a single get or put with each filename, I'd use expect http://expect.nist.gov/
Thanks for reacting so soon.
I spent some time on the suggested link that u  have given; It is totally new for me.  Not able to summarize what exactly and how to put it action to fit on my requirement.  I will highly appreciate If you already does it,  can u please paste resolution of the question ,atleast I will get the idea and I will take it forward for the next time.


Dear experts,
Any alternate solution on this,  please advice
# just a rough idea how it works:

spawn "/path/to/psftp" remotehost
sleep 3
puts "USER your user here\n"
expect {
  password { send "your password here"; exp_continue;}
  "remotehost-prompt#" { send "put your-filename-here"; exit; }
  timeout    { puts "connection timeout\n"; exit; }
}

# see expect man-page for detailed examples
ASKER CERTIFIED SOLUTION
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
omarfiied,
This also an excellent trick That I didn’t get before ,this  also well and good.  Hope you agree with me that some of the tricks comes with  time.

Thanks any way …
Hi,

This is called innovation :) (just jocking)
ohh great fun with you,  
your idea solved mys issue .

great @ keep this up always