Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some company use FTP to publish the updates that we need from then, is there a software to automatize that? or i will to bash-script the process? any ideas?

share|improve this question

closed as off-topic by yoonix, Zoredache, womble Jun 8 at 1:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

    
Did you try googling this before asking all of us to help you? How about using that chance to shame the company that forces you to still use an insecure protocol? – chicks Jun 7 at 17:53
    
Possible duplicate of Cron Job for FTP download – chicks Jun 7 at 17:53

10 Answers 10

up vote 5 down vote accepted

There are lots of good suggestions. Also check out wget or curl.

share|improve this answer

If you are looking to automatically download whatever is published to an FTP site, you could use rsync, running it as a cron job:

rsync -P -v -r ftp.nluug.nl::Mandrakelinux/official/2006.0/i586/install/images/ .

See http://www.brunolinux.com/10-General_Info/Rsync.html for more information about rsync.

share|improve this answer
    
Doesn't the site need to be running a rsync server? Many public ftp servers also offer http/rsync, but I am not sure that 'some company' will. – Zoredache Jun 3 '09 at 17:32
    
The remote site is running on Win2k3+FTP via IIS and we have an username and password, does this matter? – Ariel Antigua Jun 3 '09 at 17:41
    
Yes, it does. IIS will not support rsync out of the box. Rsync is a good solution for speeding up data syncronization, but it requires a client/server setup to work. – Avery Payne Jun 3 '09 at 19:09
    
If this isn't Linux as originally tagged, then rsync is not a good choice. One of the wget/curl/ncftpget answers makes more sense then. – CoverosGene Jun 4 '09 at 12:11

Quickly

open ftp.address.co.uk
quote USER username
quote PASS password
cd ftp/dir
put file
bye

you can then run ftp -n < backup.sh, where backup.sh is the code above. I wrote some fancy create folders with todays date before running the ftp command. If anyones interested I can post them up here.

share|improve this answer

Agree that rsync is good, but an alternative is lftp. It has automated and interactive shell-like modes, and supports options that make mirroring simple.

share|improve this answer

ftpcopy used to be my quick choice for mirroring:

ftpcopy is a simple FTP client written to copy files or directories (recursively) from an FTP server. It was written to mirror FTP sites which support the EPLF directory listing format, but it also supports the traditional listing format (/bin/ls). . ftpls is an FTP client which generates directory listings, either in plain text or HTML. . The tools only support passive mode FTP. There is no plan to support active mode. . See http://www.ohse.de/uwe/ftpcopy.html for more information. Bugs: mailto:ubuntu-users@lists.ubuntu.com Origin: Ubuntu

share|improve this answer

I've used ncftpget

to script ftp gets.

share|improve this answer

You'll probably have to bash-script it, but wrap it around ncftpget and/or ncftpput as that will let you get or put files from the command line.

share|improve this answer

I use a python script for this purpose, you can easly implement ini files for the script and if you want to schedule it under windows you can build an exe with py2exe. Youcan grab a sample code here.

share|improve this answer

wget can download recursivly using the -r (recrusive) or -m (mirror) options. Check the man page for more information.

You could write a bash script, but you probably don't need to. You could just put the wget command line into a cron and it'll be executed regularly.

share|improve this answer

Another way is to create a bash script like this:

#! /bin/bash

ftp -n << 'EOF'
open ftp.your_ftp_host.com
quote USER your_username_here
quote PASS your_password_here
cd gets
prompt no
mget *.txt .
bye
EOF
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.