View on GitHub

merge-firefox-history

Script designed to merge the browsing history from two Firefox profile databases.

merge-firefox-history

Description

This script merges Firefox history databases (places.sqlite) by combining the moz_places and moz_historyvisits tables from two databases into a single database. It allows you to consolidate your browsing history from multiple Firefox profiles or instances.

Prerequisites

Usage

merge-firefox-history.sh <db1> <db2> [backup_location] [-s|--skip-vacuum] [-h|--help]

Arguments

Example

./merge-firefox-history.sh ~/.mozilla/firefox/profile1.default-release/places.sqlite ~/.mozilla/firefox/profile2.default-release/places.sqlite

This command merges the history from ~/.mozilla/firefox/profile1.default-release/places.sqlite and ~/.mozilla/firefox/profile2.default-release/places.sqlite into the first database file.

The script will prompt for user confirmation before proceeding with the merge. Enter y or yes to confirm. 0 will be returned on success, while 1 will be returned on error.

Features

Requirements

Troubleshooting

Limitations

Log file

The script logs detailed information with timestamps in the merge.log file. Here’s an example of the log file content:

[2024-03-10 11:32:42] Proceeding with the merge...
[2024-03-10 11:32:42] Vacuuming databases before merging...
[2024-03-10 11:32:42] Vacuuming database 'places-0.sqlite'...
[2024-03-10 11:32:43] Vacuuming completed for database 'places-0.sqlite'.
[2024-03-10 11:32:43] Vacuuming database 'places-1.sqlite'...
[2024-03-10 11:32:43] Vacuuming completed for database 'places-1.sqlite'.
[2024-03-10 11:32:43] Vacuuming completed for both databases.
[2024-03-10 11:32:43] Created backup of places-0.sqlite at places-0.sqlite.backup_20240310_113243
[2024-03-10 11:32:48] Merge completed successfully.
[2024-03-10 11:32:48] Merge script execution completed.

Future enhancements

License

This script is released under the ISC License.