bookmark-merge.pl 1.1
18 March 2001
Copyright (c) 2000-2001 Rob McMullen (robm@users.sourceforge.net)

http://bookmark-merge.sourceforge.net/



ABSTRACT
========

bookmark-merge.pl is a perl script that merges Netscape/Mozilla format
bookmark files.  I found that I was maintaining bookmarks at home and
at work, and they would continually diverge as I found cool links at
one site or the other.  This script merges two (or more) bookmark
files into one, trying to be smart about the ordering of the
bookmarks.  The resulting bookmark file is the union of all of the
bookmark files, where the structure is built from the master file.



BACKGROUND
==========

Originally, I figured that someone had solved this problem already, so
I looked around for a program that would merge bookmark files.  There
are a few out there, including another project hosted on SourceForge:
Jeremy Buchmann's http://sourceforge.net/projects/merge/

His script worked well, but I liked keeping the ordering of my
bookmarks.  I don't alphabetize my bookmarks within a folder, I
usually order them by how often I hit the link.

Rather than modifying his script, I decided to write my own.  I felt
that this task would be an ideal use for object orientation and
recursive design.



FEATURES
========

* Merges two or more bookmark files into one master copy

* Preserves ordering of folders and of bookmarks within folders

* Attempts to insert new items in master bookmark file in the same
  relation as the bookmarks exist relative to the other bookmarks in
  the importing file

* Perl 5, object oriented design



KNOWN ISSUES
============

* This script handles Netscape/Mozilla format bookmarks only.

* Aliased bookmarks are not handled.  All information about bookmark
  aliases are stripped out of the generated bookmark file.

* Bookmark descriptions are not handled.  They are silently ignored,
  and are left out of the generated bookmark file.

* Netscape doesn't seem to update the LAST_MODIFIED field of bookmarks
  if all you do is edit the name or location of the bookmark.  Not
  really a bug in bookmark-merge per se, but something to be aware of
  if you are expecting name changes in the importing bookmarks to be
  copied over to the master bookmark file.

* Mozilla bookmarks include ID tags on the folders, which the script
  mostly ignores.  The only ID tag that the script handles is the
  PersonalToolbarFolder keyword, which is recognized.  All other ID
  tags are left unchanged in the master bookmark file.

* The number of entries in the resulting bookmark file is always as
  large or larger than the number in the master bookmark file.  So far,
  there isn't any way to mark that an entry should be deleted.
  Instead, the model is to syncronize all bookmark files back out to
  all your machines after merging and deleting unwanted bookmarks from
  the single merged copy.



USAGE
=====

The script is run with the following command:

bookmark-merge.pl [-o output] [-v] [-j date] master_file merging_file [other_files ...]

  -o output

    This is an optional parameter that names the new file to be
    created for the resulting new bookmarks.  If this parameter is not
    specified, the new bookmark file is sent to standard output.

  -j date_in_seconds_since_1970

    This is an optional parameter that speficies a date which all new
    items must be newer than in order to be merged.  The date is
    specified as a time_t value, that is, the time in seconds since
    Jan. 1, 1970.  This can be passed to the program using the
    backtick operator of the shell and the standard unix date command:

	bookmark-merge.pl -j `date --date="Jan 1 2000" +%s"` a.html b.html

    Thanks to Peter Westerstrom (digimatic@users.sourceforge.net) for
    this patch.

  -v

    Verbose flag.  This prints gargantuan amounts of information to
    STDERR as the script is processing the files.  Useful mostly for
    debugging, or for those interested in seeing how the script
    operates.

  master_file

    This is the main bookmark file that you want the other files to be
    merged into.  This is the baseline file; all bookmarks that are
    new in the other files are added to this file.  The basic
    structure of the new bookmark file is therefore taken from this
    file.

  merging_file [other_files ...]

    These files (one or more files) are the other bookmark files that
    are going to be merged into the master file.




DISCLAIMER
==========

bookmark-merge.pl, Copyright (c) 2000-2001 Rob McMullen (robm@users.sourceforge.net)

bookmark-merge.pl comes with ABSOLUTELY NO WARRANTY; for details see
the file COPYING included in the source distribution, or see the web site
http://www.gnu.org/copyleft/gpl.html for more information.

That means that I can't be held responsible for this program
overwriting your bookmark files, deleting your operating system, or
disrupting the earth's gravity field causing a meteorite impact crater
where your monitor used to be.  I use this program all the time, but
that doesn't mean that there isn't some potentially nasty bug lurking
somewhere.  I hope there isn't; I have done my best to test the
script.  However, this is provided for you to use at your own risk.
Make backup copies of any files before attempting to use this program.

I hope you enjoy this program, and that it saves you some time.

Have fun!