Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
"be consistent"
 
PerlMonks  

nightly backup of new files on a FTP-Site

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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...

  • Comment on nightly backup of new files on a FTP-Site

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 15: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 Cine (Friar) on Jul 30, 2002 at 15: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 anolte (Novice) on Jul 30, 2002 at 16: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 16: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 mitd (Curate) on Jul 31, 2002 at 02: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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.