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,094 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
  • 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now