Solved

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

Posted on 2007-11-14
10
7,218 Views
Last Modified: 2013-12-26
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
Comment
Question by:mansur_mca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 20286712
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 20290971
if mget is not allowed, then you need to use get/put with a full filename
0
 
LVL 1

Author Comment

by:mansur_mca
ID: 20303378
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Expert Comment

by:ahoffmann
ID: 20303756
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
 
LVL 1

Author Comment

by:mansur_mca
ID: 20304045
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 20304805
# 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
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
ID: 20307429
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
 
LVL 1

Author Comment

by:mansur_mca
ID: 20312428
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
 
LVL 40

Expert Comment

by:omarfarid
ID: 20312445
Hi,

This is called innovation :) (just jocking)
0
 
LVL 1

Author Comment

by:mansur_mca
ID: 20322275
ohh great fun with you,  
your idea solved mys issue .

great @ keep this up always
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
In this post we will learn different types of Android Layout and some basics of an Android App.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question