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.
If you’re thinking about purchasing a new GPU, we’d greatly appreciate it if you used our Amazon Associate links. The price you pay will be exactly the same, but Amazon provides us with a small commission for each purchase. It’s a simple way to support our site and helps us keep creating useful content for you. Recommended GPUs: RTX 5090, RTX 5080, and RTX 5070. #ad
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[0])
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()
Leave a Reply