Backup Firefox/Chrome Bookmarks - VBScript or Kix

Posted on 2013-06-09
Last Modified: 2013-06-09

I need a script in either vbscript or kix to backup Firefox and Chrome bookmarks.
The script should check for a profile folder for either browser and backup the following to the  to U:\ drive.

The folder I need backed-up for Firefox is:
Firefox - %APPDATA%\Mozilla\Firefox\Profiles\[PROFILE NAME]\bookmarkbackups

The files I need backed-up for Chrome are:
Chrome - %LOCALAPPDATA%\Google\Chrome\User Data\Default\Bookmarks and Bookmarks.bak

If a profile does not exist then it should be skipped. A log file should be created.

I appreciate your help on this.

Question by:ivanoviola
  • 2
LVL 42

Expert Comment

ID: 39233025
LVL 42

Accepted Solution

sedgwick earned 500 total points
ID: 39233038
here complete script:
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")

destination = "U:\"
appdata = objShell.ExpandEnvironmentStrings("%APPDATA%")
localAppData = objShell.ExpandEnvironmentStrings("%LOCALAPPDATA%")

ff_bookmarks = appdata & "\Mozilla\Firefox\Profiles\"
chrome_bookmarks = localAppData & "\Google\Chrome\User Data\Default\Bookmarks"
chrome_bookmarks_bak = localAppData & "\Google\Chrome\User Data\Default\Bookmarks.bak"

For Each Subfolder in FSO.GetFolder(ff_bookmarks).SubFolders
	ff_profile_bookmarks = Subfolder.Path & "\bookmarkbackups"
	if (fso.FolderExists(ff_profile_bookmarks)) then
		fso.CopyFolder ff_profile_bookmarks, destination
		wscript.echo "copy " & ff_profile_bookmarks & " to " & destination
	end if

If (fso.FileExists(chrome_bookmarks_bak)) Then
	fso.CopyFile chrome_bookmarks_bak , destination & "Bookmarks.bak"
	wscript.echo "copy " & chrome_bookmarks & " to " & destination
end if	

If (fso.FileExists(chrome_bookmarks)) Then
	fso.CopyFile chrome_bookmarks , destination & "Bookmarks"
	wscript.echo "copy " & chrome_bookmarks & " to " & destination
end if

wscript.echo "Done."

Open in new window

if u change the destination, make sure to have slash at the end (i.e. "U:\some-folder\")

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question