Skip to content

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

License

Notifications You must be signed in to change notification settings

perennialtech/merge-firefox-history

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • <db1>: Path to the first Firefox history database file.
  • <db2>: Path to the second Firefox history database file.
  • [backup_location]: (Optional) Path to the directory where the backup of the first database will be stored. If not provided, the backup will be created in the current directory.
  • [-s|--skip-vacuum]: (Optional) Skip vacuuming the databases before merging.
  • [-h|--help]: Display the help menu.

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

  • Merges Firefox history databases while ensuring unique IDs and avoiding conflicts.
  • Deduplicates history visits based on place_id and visit_date to prevent duplicate entries.
  • Creates a backup of the first database before merging.
  • Performs integrity checks on the input databases.
  • Vacuums the databases before merging to optimize performance.
  • Provides progress tracking during the merge process.
  • Logs detailed information with timestamps in the merge.log file.

Requirements

  • The script assumes the Firefox history database schema and uses SQLite commands.
  • SQLite must be installed on the system.

Troubleshooting

  • If the integrity check fails for one of the input databases, the script will abort the merge process. Ensure that both databases are valid and accessible.
  • If an error occurs during the merge process, the script will roll back the changes and restore the original state of the first database.

Limitations

  • Merging large databases may take a considerable amount of time. Ensure sufficient disk space and system resources are available.

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

  • Improved error handling and reporting.

License

This script is released under the ISC License.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Shell 100.0%