• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7495
  • Last Modified:

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
0
mansur_mca
Asked:
mansur_mca
  • 4
  • 3
  • 2
  • +1
1 Solution
 
knightEknightCommented:
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
0
 
ahoffmannCommented:
if mget is not allowed, then you need to use get/put with a full filename
0
 
mansur_mcaAuthor Commented:
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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ahoffmannCommented:
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/
0
 
mansur_mcaAuthor Commented:
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
0
 
ahoffmannCommented:
# 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
0
 
omarfaridCommented:
Hi,

Since your psftp is not supporting mget, can you zip the files as one file, get the zipped file, and unzip it locally?

0
 
mansur_mcaAuthor Commented:
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 …
0
 
omarfaridCommented:
Hi,

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

great @ keep this up always
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now