In the past, I usually downloaded the latest FireFox manually for setting up machines. It’s kinda tedius and I finally decided to write a script to do it automatically. Here is the code. Note that the site doesn’t not get updated frequently. For example, the latest FireFox 3.0.4 didn’t appear at the site several days after it’s available to public. I have also modified it to download Thunderbird without a problem.
FTP_SITE = 'releases.mozilla.org' REMOTE_DIR = '/pub/mozilla.org/firefox/releases/latest/win32/en-US/' LOCAL_DIR = 'c:/Software/firefox/' FILE_MASK = '*.exe' from ftplib import FTP import os def handleDownload(block): downloaded_file.write(block) ftp = FTP(FTP_SITE) ftp.connect() ftp.login('anonymous') remote_files = ftp.nlst(REMOTE_DIR + FILE_MASK) newestfilename = os.path.basename(remote_files) if not os.path.exists(LOCAL_DIR + newestfilename): downloaded_file = open(LOCAL_DIR + newestfilename, 'wb') ftp.retrbinary('RETR ' + REMOTE_DIR + newestfilename , handleDownload) downloaded_file.close() ftp.close()