From 14a892e627a375334a02381351f139d94ad7ecf3 Mon Sep 17 00:00:00 2001 From: ダカマ Date: Mon, 2 Jun 2025 13:08:46 +0200 Subject: First dump --- "miscripts/Export Chrome Bookmarks as HTML\n" | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 "miscripts/Export Chrome Bookmarks as HTML\n" (limited to 'miscripts/Export Chrome Bookmarks as HTML ') diff --git "a/miscripts/Export Chrome Bookmarks as HTML\n" "b/miscripts/Export Chrome Bookmarks as HTML\n" new file mode 100644 index 0000000..7bc5c51 --- /dev/null +++ "b/miscripts/Export Chrome Bookmarks as HTML\n" @@ -0,0 +1,54 @@ +#credits: Mostly to tobibeer and Snak3d0c @ https://stackoverflow.com/questions/47345612/export-chrome-bookmarks-to-csv-file-using-powershell +#Path to chrome bookmarks +$pathToJsonFile = "$env:localappdata\Google\Chrome\User Data\Default\Bookmarks" + +$htmlOut = 'C:\temp\ChromeBookmarks.html' +$htmlHeader = @' + + + +Bookmarks +

Bookmarks

+

+'@ + +$htmlHeader | Out-File -FilePath $htmlOut -Force -Encoding utf8 #line59 + +#A nested function to enumerate bookmark folders +Function Get-BookmarkFolder { +[cmdletbinding()] +Param( +[Parameter(Position=0,ValueFromPipeline=$True)] +$Node +) + +Process +{ + + foreach ($child in $node.children) + { + $da = [math]::Round([double]$child.date_added / 1000000) #date_added - from microseconds (Google Chrome {dates}) to seconds 'standard' epoch. + $dm = [math]::Round([double]$child.date_modified / 1000000) #date_modified - from microseconds (Google Chrome {dates}) to seconds 'standard' epoch. + if ($child.type -eq 'Folder') + { + "

$($child.name)

" | Out-File -FilePath $htmlOut -Append -Force -Encoding utf8 + "

" | Out-File -FilePath $htmlOut -Append -Force -Encoding utf8 + Get-BookmarkFolder $child + "

" | Out-File -FilePath $htmlOut -Append -Force -Encoding utf8 + } + else + { + "

$($child.name)" | Out-File -FilePath $htmlOut -Append -Encoding utf8 + } #else url + } #foreach + } #process +} #end function + +$data = Get-content $pathToJsonFile -Encoding UTF8 | out-string | ConvertFrom-Json +$sections = $data.roots.PSObject.Properties | select -ExpandProperty name +ForEach ($entry in $sections) { + $data.roots.$entry | Get-BookmarkFolder +} +'
' | Out-File -FilePath $htmlOut -Append -Force -Encoding utf8 -- cgit v1.2.3