Tools@BasicAware

Samples - Putting the pieces together

Here's a sample of how to use the tools on this site.

Firefox Bookmarks Backup

Mozilla Firefox stores the bookmarks in a SQLite database in the user's (Firefox) profile folder. If you've ever lost your years worth of bookmarks collection, you know how I felt when that collection somehow vanished (the DB got corrupted). Of course, Murphy's Law was immediately invoked, meaning I didn't recognize right away that my bookmarks were missing and I've sync'd my FF bookmarks across different devices. Needless to say that I managed to wipe the good bookmarks there too before noticing what happened. Fortunately there was one device left with a good (although older) copy of my bookmarks. That's when I put the following batch together.

The following sample batch file

  1. Copies the bookmarks SQLite database (places.sqlite) to a backup folder
  2. Renames the database file (RENToday), ensuring a unique and chronological name.
  3. Deletes backup files older than one month (DeleteFilesOlderThan), so that we both have enough "good copies" and don't waste too much space.

I've created a Scheduled Task job to run that batch at login.


FFPlacesBackup.cmd

I've created the following batch file named FFPlacesBackup.cmd. Of course, you're free to pick whichever name fits your needs. Please not that the name of the folder \abcdefgh.default\ is randomly created by Firefox. You need to change that in the below sample to match the folder name of your Firefox installation.

I've also created the folder \bookmarkbackups\ within my Firefox profile folder. That's the place where the backups are kept. Needless to say that you can change that to whichever folder location suit your needs.

@ECHO OFF
COPY %APPDATA%\Mozilla\Firefox\Profiles\abcdefgh.default\places.sqlite %APPDATA%\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\.

RenToday /f=%APPDATA%\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\places.sqlite /p=places_

DeleteFilesOlderThan /t=1m /p=%APPDATA%\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\ /f=*.sqlite


The results ...

Running the above batch produces this output:


1 Datei(en) kopiert.

• RENToday v1.5.0 •
Copyright © 2002-2016 by BasicAware. All rights reserved.
Written by Knuth Konrad

Source file : C:\Users\MyName\AppData\Roaming\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\places.sqlite
Overwrite : False
Prefix : places_

-- Scanning for file C:\MyName\Knuth\AppData\Roaming\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\places.sqlite
Renaming C:\Users\MyName\AppData\Roaming\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\places.sqlite
-> C:\Users\MyName\AppData\Roaming\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\places_20170209_120732_554.sqlite

File(s) renamed: 1

• DeleteFilesOlderThan v1.4.4 •
Copyright © 2013-2016 by BasicAware. All rights reserved.
Written by Knuth Konrad

Time : 1m
Folder : C:\Users\MyName\AppData\Roaming\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\
File pattern : *.sqlite
Recurse subfolders: False
Verbose : False

-- Scanning folder C:\Users\MyName\AppData\Roaming\Mozilla\Firefox\Profiles\abcdefgh.default\bookmarkbackups\
- File pattern: *.sqlite
- Skipping places_20170110_101453_935.sqlite
- Skipping places_20170111_101724_327.sqlite
- Skipping places_20170111_142204_282.sqlite
- Skipping places_20170112_101723_323.sqlite
- Skipping places_20170113_101326_630.sqlite
- Skipping places_20170114_101708_046.sqlite
- Skipping places_20170116_101225_364.sqlite
- Skipping places_20170117_100806_085.sqlite
- Skipping places_20170118_101152_227.sqlite
- Skipping places_20170119_102351_736.sqlite
- Skipping places_20170120_101846_855.sqlite
- Skipping places_20170120_142344_553.sqlite
- Skipping places_20170123_101915_756.sqlite
- Skipping places_20170124_102239_912.sqlite
- Skipping places_20170125_102154_564.sqlite
- Skipping places_20170126_101948_082.sqlite
- Skipping places_20170127_102329_863.sqlite
- Skipping places_20170130_101639_178.sqlite
- Skipping places_20170130_114610_723.sqlite
- Skipping places_20170131_101444_509.sqlite
- Skipping places_20170201_101733_713.sqlite
- Skipping places_20170202_101437_919.sqlite
- Skipping places_20170203_101808_916.sqlite
- Skipping places_20170207_185508_254.sqlite
- Skipping places_20170208_101900_028.sqlite
- Skipping places_20170209_101320_210.sqlite
- Skipping places_20170209_112033_026.sqlite
- Skipping places_20170209_113120_631.sqlite
- Skipping places_20170209_114649_372.sqlite
- Skipping places_20170209_120732_554.sqlite


Done. 0 file(s) deleted.
Disk space freed: 0 bytes

15.10.2024

Navigation

Tools

Info

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Germany License .
All contents copyright © 2012-2024 by BasicAware, Knuth Konrad