LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   FTP get script wildcard (https://www.linuxquestions.org/questions/linux-newbie-8/ftp-get-script-wildcard-705010/)

abharsair 02-16-2009 05:54 AM

FTP get script wildcard
 
Hi guy's please can you help? I've written a ftp script that should log onto the ftp location and drag back any file that ends in a .dat extension, however I can't get the wildcard *.dat to work...

The script works fine if I put a full filename in however....I'm lost..

#!/bin/bash

remote=ftpadd
username=user
passwd=password
localdir=/local/dir/
remotedir=/remote/dir/

ftp -in <<EOF
open $remote
user $username $passwd
lcd $localdir
cd $remotedir
get *.dat
close
bye
EOF

colucix 02-16-2009 05:56 AM

Use mget instead of get.
Code:

ftp> help mget
mget            get multiple files


abharsair 02-16-2009 06:30 AM

cool, will that work with the * wildcard too?

colucix 02-16-2009 06:32 AM

Quote:

Originally Posted by abharsair (Post 3445382)
cool, will that work with the * wildcard too?

Of course. Just try and find out! :)

abharsair 02-16-2009 06:33 AM

thank you :D it worked a treat


All times are GMT -5. The time now is 10:20 PM.