How to specify more then one pattern in a single mget statement of ftp command?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to specify more then one pattern in a single mget statement of ftp command?
# 1  
Old 05-02-2013
How to specify more then one pattern in a single mget statement of ftp command?

hi,

i am using ftp command to get some files from a remote server.

if the remote server contains files of different extension.

Code:
abc.txt
def.txt
ghi.lst
jkl.cnf

is it possible to get all the three type of files in one ftp?

i am using this ftp command

Code:
$FTP $Remote_server <<_FTP1
     quote USER $username
     quote PASS $password
     cd $folder
     prompt noprompt
     binary
     mget *.txt
     quit
_FTP1

the above ftp code takes only files of extension .txt.

if there are more than one type of files files say *.txt, *.cnf, *.lst. how should i specify these 3 patterns in the single mget statement inside ftp command.
is it possible to include a for loop or any other loop inside the ftp command?
# 2  
Old 05-02-2013
Have you tried
Code:
mget *.txt *.cnf *.lst

? if yes did you receive any error?
This User Gave Thanks to vidyadhar85 For This Post:
# 3  
Old 05-02-2013
You can normally say mget *.txt *.cnf *.lst

It's OK to experiment around. Nothing's going to "break". Smilie

AFAIK, ftp has no for loop.
This User Gave Thanks to hanson44 For This Post:
# 4  
Old 05-02-2013
ya it works fine.
# 5  
Old 05-02-2013
ftp indeed has no for loop or other such control structures, it's very simple and stupid. That it even has anything like mget is something to be grateful for Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Prompt problem while using mget to ftp

I am writing a scritp in which first step is to get some files from a server. I am using mget to do that. here is my FTP code ... HOST="XXX.XXX.com" 28 ftp -inv $HOST <<END &> $FTP_LOG 29 quote USER $USER 30 quote PASS $PASWD 31 cd log 32 prompt off 33 binary 34 mget... (0 Replies)
Discussion started by: shashidhar
0 Replies

2. Shell Programming and Scripting

Ftp mget exclusion question

In the script I am doing a mget for multiple files. How can I exclude just one file which I do not need to ftp ? (3 Replies)
Discussion started by: jville
3 Replies

3. Shell Programming and Scripting

Problem in using ftp command under if statement

If i use ftp command under if statement it shows the error "Syntax error at line 19 : `<<' is not matched." But if i use ftp command outside if statement, then it is running fine. Can anyone please help me in this. Code: #!/bin/sh echo "\nPress 1 for automated file dumping." echo... (9 Replies)
Discussion started by: makauser
9 Replies

4. Shell Programming and Scripting

awk pattern match and search in single statement

Hi All, I am trying to alter all lines between EXEC SQL and END-EXEC that have an INCLUDE in them. The following code search="INCLUDE " cp -f ${WORK}/$file.in ${WORK}/$file.wrk2 for item in `echo $search `; do > ${WORK}/$file.wrk1 awk -vITEM="$item" '{ if ( $0... (3 Replies)
Discussion started by: Bruble
3 Replies

5. Shell Programming and Scripting

problem with ftp mget

Hi I am trying to ftp all the files from a directory in server2 to server1 (both unix) The below code is in server1 ftpfile=/home/anitha/ftptxt echo cd mydir >>$ftpfile echo mget *.* >>$ftpfile cat $ftpfile | ftp -i server2 mydir is a directory in server2 and there are some test files in... (4 Replies)
Discussion started by: anijan
4 Replies

6. AIX

ftp mget directory

Hi, I have searched everywhere for an answer to this question but couldn't find one so I ask it here. From an AIX 5.3 machine I ftp to another AIX 5.3 server. I want to get all files and only files in a directory. This directory has a subdirectory with files in it. In ftp, I enter the... (5 Replies)
Discussion started by: bheinsius
5 Replies

7. Shell Programming and Scripting

Ftp-mget

For the below mentioned code..Files are getting transferred from first mget statement alone ie from /home/Arun/*EF01/...Could someone help me regarding this ftp -vn <<EOD >$LOG open user lcd ascii mget /home/Arun/*EF01/GLHEC* mget /home/Arun/*EF03/GLHEC* mget... (3 Replies)
Discussion started by: infernalhell
3 Replies

8. Shell Programming and Scripting

mget ftp command options

Hi, I am using mget ftp command to pull a bunch of zip files from Windows to local unix machines. It is working fine as follows. -rw------- 1 autosys autosys 614 Aug 19 13:13 02034128.zip -rw------- 1 autosys autosys 1866 Aug 19 13:13 02034127.zip -rw------- 1 autosys ... (1 Reply)
Discussion started by: spatra
1 Replies

9. UNIX for Advanced & Expert Users

mget ftp command options

Hi, I am using mget ftp command to pull a bunch of zip files from Windows to local unix machines. It is working fine as follows. -rw------- 1 autosys autosys 614 Aug 19 13:13 02034128.zip -rw------- 1 autosys autosys 1866 Aug 19 13:13 02034127.zip -rw------- 1 autosys autosys 14592 Aug 19... (1 Reply)
Discussion started by: spatra
1 Replies

10. UNIX for Dummies Questions & Answers

mget (ftp command)

hey, I was wondering if its possible to use a complete path and file name using the mget command example mget /dir1/dir2/dir3/file.ext or get /dir1/dir2/dir3/file.ext because whenever i try its says file not found or permission denied..... but if i do cd dir1 cd dir2 cd dir3 mget... (2 Replies)
Discussion started by: Ganondorf
2 Replies
Login or Register to Ask a Question