1834640 Members
3277 Online
110069 Solutions
New Discussion

Re: FTP and wildcards

 
Jessie Jackson
Occasional Contributor

FTP and wildcards

I am trying for find out how I can use FTP to recognize a wild card so That I can use mget or the like to retrieve multiple files. I am wanting to do this through CRON in a script.

Maybe some has some suggestions.
5 REPLIES 5
Tracey
Trusted Contributor

Re: FTP and wildcards

mget *.dat
mput *.dat

If it is in a file you may have to delimit the asterik:

mget \*.dat
mput \*.dat
Chad Molina
Occasional Advisor

Re: FTP and wildcards

Well, assuming you are going to use this in a script ... Give this a shot:

FTP> prompt off
FTP> mget file*.dat

This will turn interactive mode off which will prevent you from having to keep pressing y to confirm each file transfer. And thats all there is to it!

Chad
If ya feel froggy ... start hopping
CAULIER Remy
New Member

Re: FTP and wildcards

If you want to use FTP command with cron, write a small shell with command:
ftp -i < commandfile
With -i option FTP doesn't ask to confirm file transfer

commandfile is a text file and contains ftp commands e.g.:
open RemoteHost
mput *.dat
mput file??.txt
close
bye
As you know, don't forget machine, login and password in .netrc file.
DoItYourself
Wodisch
Honored Contributor

Re: FTP and wildcards

Hello Jessie,
read the man-page for "netrc" and create a "~/.netrc"
for the user under which account the crontab'ed ftp
is to ru:
machine TARGET login USER password SECRET macdef init
cd /target
lcd /source
prompt
mput *
quit

The empty line at the end is needed and the permissions
should be "400" or "600" or the command "ftp" will not
use it. "TARGET" is the target-machin name, "USER" is the
user-account on the target-machine, "SECRET" his/her
password (and instead of "mput" you might use "mget"
for retrieving files from there).
HTH,
Wodisch
K.Vijayaragavan.
Respected Contributor

Re: FTP and wildcards

Hi,

any one know why we can't copy multiple folders using ftp's command "mput *"

it gives error message,
"is not a flat file " .

regards

vijay
"Let us fine tune our knowledge together"