LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2009, 06:54 AM   #1
abharsair
LQ Newbie
 
Registered: Jan 2009
Posts: 17

Rep: Reputation: 0
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
 
Old 02-16-2009, 06:56 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Use mget instead of get.
Code:
ftp> help mget
mget            get multiple files
 
Old 02-16-2009, 07:30 AM   #3
abharsair
LQ Newbie
 
Registered: Jan 2009
Posts: 17

Original Poster
Rep: Reputation: 0
cool, will that work with the * wildcard too?
 
Old 02-16-2009, 07:32 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by abharsair View Post
cool, will that work with the * wildcard too?
Of course. Just try and find out!
 
Old 02-16-2009, 07:33 AM   #5
abharsair
LQ Newbie
 
Registered: Jan 2009
Posts: 17

Original Poster
Rep: Reputation: 0
thank you it worked a treat
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP Script tommytomato Linux - General 28 07-14-2006 06:16 AM
Urgent Help: Perl FTP Script Using NET::FTP xboxter Programming 8 05-16-2005 07:57 PM
script for a command that won't accept wildcard value hemp4fuel Programming 4 05-24-2004 06:30 AM
Ftp script scialom Linux - Software 2 05-04-2004 04:03 PM
cat sh script wildcard problem scm Programming 8 04-21-2004 06:19 AM


All times are GMT -5. The time now is 08:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration