Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

nightly backup of new files on a FTP-Site

by dreamy (Sexton)
on Jul 30, 2002 at 19:39 UTC ( [id://186320]=perlquestion: print w/replies, xml ) Need Help??

dreamy has asked for the wisdom of the Perl Monks concerning the following question:

I'm about to implement a small app running via cron, which connects to a ftp-server, reads the directory list, compares local/remote files and downloads remote changes - if found.

(background: files are generated online by a CMS and could be lost after a server crash)

my question: are there any modules or applications i could use as a starting point (i plan to use Net::FTP of course) or maybe someone else solved that case already...

Replies are listed 'Best First'.
Re: nightly backup of new files on a FTP-Site (use rsync)
by grinder (Bishop) on Jul 30, 2002 at 19:44 UTC
    Once you have to worry about whether files change, it becomes rather painful to do it with Net::FTP. The canonical approach to this problem is to put Perl aside and reach for rsync instead. It's the right tool for the right job.


    print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
Re: nightly backup of new files on a FTP-Site
by anolte (Novice) on Jul 30, 2002 at 20:04 UTC
    .. if you do not like rsync, try ncftp ( www.ncftp.com ) in mirror mode. Also I remember lurking a skript called mirror.pl in old Linux distributions. If you want to do it in perl, you might ask Mr. Google, if he still finds this skript ..
Re: nightly backup of new files on a FTP-Site
by robobunny (Friar) on Jul 30, 2002 at 20:12 UTC
    mirror does this, and is written in perl. it isn't particularly efficient though, it parses the output of ls -lR, which can be very slow for large directory structures.
Re: nightly backup of new files on a FTP-Site
by Cine (Friar) on Jul 30, 2002 at 19:46 UTC
    Goggle for rsync (I dont know if it supports updates via ftp though)

    T I M T O W T D I
Re: nightly backup of new files on a FTP-Site
by mitd (Curate) on Jul 31, 2002 at 06:07 UTC
    First off rsync, as has been stated, really looks like the right way to go but just in case you would like to look at pure Perly approach check out merlyn's Smoke and Mirrors -- Linux Magazine (Jan 02).

    mitd-Made in the Dark
    'Interactive! Paper tape is interactive!
    If you don't believe me I can show you my paper cut scars!'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://186320]
Approved by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-28 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found