0

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?

2
  • 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, 2016 at 17:53
  • Possible duplicate of Cron Job for FTP download
    – chicks
    Jun 7, 2016 at 17:53

10 Answers 10

5

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

1

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.

4
  • 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, 2009 at 17:32
  • The remote site is running on Win2k3+FTP via IIS and we have an username and password, does this matter? Jun 3, 2009 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. Jun 3, 2009 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. Jun 4, 2009 at 12:11
1

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.

1

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.

1

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:[email protected] Origin: Ubuntu

0

I've used ncftpget

to script ftp gets.

0

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.

0

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.

0

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.

0

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

Not the answer you're looking for? Browse other questions tagged .