added quick notes for restoring attachments

This commit is contained in:
2022-02-09 10:25:58 -05:00
parent 5f3e7e0c1a
commit baca57dd2b

View File

@@ -148,4 +148,31 @@ if ($zip -or $encrypt) {
# logout of bitwaren to ensure the session is destroyed
& $bw logout
# remove all the variables
Remove-Variable -Name * -ErrorAction SilentlyContinue
Remove-Variable -Name * -ErrorAction SilentlyContinue
<#
# Restore of attachements
cd C:\users\jgaunt\Git\bitwardenbackup\attachments
bw status
$folders = Get-childItem -Directory
$items = bw list items | convertfrom-json
$array = @()
foreach ($folder in $folders) {
foreach ($item in $items) {
if ($folder.name -eq $item.name -and $item.type -gt 1) {
#$array += bw get item $item.id | convertfrom-json
$attachements = Get-ChildItem $folder
foreach ($attachement in $attachements) {
bw create attachment --file "$($attachement.FullName)" --itemid $item.id
}
Remove-Item -Recurse $folder
}
}
}
#>