Your Firefox profile houses some pretty important stuff such as bookmarks, saved passwords and preferences which would be quite inconvenient to lose. As with any valuable data, your Firefox profile should be backed up regularly.
While you can always perform the backup manually or use an external tool (such as MozBackup or FEBE), each of these options have their own shortcomings and none are a true “set it and forget it” method. Our geek oriented solution to Firefox profile backups is to use a batch script which can be run at any time. Regardless of whether or not you have Firefox open, this script will capture your current Firefox profile and store it in a zip file for easy recovery.
Overall, the script doesn’t do anything magical. It simply goes to the respective user’s Firefix profile folder and copies all the unlocked files to a temporary directory and finally creates a zip archive of the files. You will need to have the 7-Zip command line tool copied to a folder set in your Windows PATH variable in order for the zip process to complete.
@ECHO OFF TITLE Firefox Profile Backup ECHO Firefox Profile Backup ECHO Written by: Jason Faulkner ECHO SysadminGeek.com ECHO. ECHO. SETLOCAL REM Requires the 7-Zip command line tool (7za.exe) which can be downloaded at: REM http://www.7-zip.org REM This file should be placed in a folder in the PATH variable (i.e. C:Windows) REM Full path the the storage archive file (do not put in quotes) REM Make sure this directory path exists. SET BackupFileName=%USERPROFILE%DocumentsBackupFirefoxProfile.zip REM Leave everything below here alone SET TempBackupDir=%TEMP%Firefox_Profile SET TempBackupDirAction="%TempBackupDir%" IF EXIST %TempBackupDirAction% RMDIR %TempBackupDirAction% MKDIR %TempBackupDirAction% XCOPY "%APPDATA%MozillaFirefoxProfiles*" %TempBackupDirAction% /E /V /C /H /Y SET BackupFileName="%BackupFileName%" IF EXIST %BackupFileName% DEL /F /Q %BackupFileName% 7ZA a %BackupFileName% "%TempBackupDir%*" IF EXIST %TempBackupDirAction% RMDIR /S /Q %TempBackupDirAction% ENDLOCAL
Scheduling the Backup
Once you have the script in place, you simply need to schedule it via the Windows Task Scheduler. You can use the graphical interface or via the command line tool, SchTasks, to easily set it to run daily for the current user:
SchTasks /Create /SC DAILY /TN BackupFirefoxProfile /TR %UserProfile%DocumentsScriptsBackupFirefoxProfile.bat /ST 09:00 /RU <UserName> /RP <Password>
Important Note: The script makes reference to profile specific locations (%USERPROFILE% and %APPDATA%), so it is important the scheduled task runs as the respective user account you want to backup the Firefox profile for.
This script will pick up any unlocked file as part of the backup. When Firefox is open, a file named “parent.LOCK” is created and this file is not included in the backup. It is a zero byte, so bit-wise the profile backup can complete without including this file.
Certain add-ons may also lock files while Firefox is open, but our testing has not found any instances where this is the case.
- › How to Send Directions to Waze on Your Phone From Your Computer
- › How to Share and Assign Reminders on iPhone and iPad
- › How to Turn Off Automatic Picture-in-Picture on iPhone
- › How to Disable iMessage Mention Notifications on iPhone and iPad
- › How to Control Smart Home Devices in the Control Center on iPhone or iPad