mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +08:00
Super/fallback can toggle view-all (default on); admin/user stay own-only while still seeing unowned system sessions. Add restore/prune helpers so empty-shell cleanup is explicit and recoverable.
35 lines
1.1 KiB
PowerShell
35 lines
1.1 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$srcRoot = 'C:\Users\zhout\.dsh\upgrade-backup-20260914-074633\sessions'
|
|
$dstRoot = 'C:\Users\zhout\.dsh\sessions'
|
|
|
|
if (-not (Test-Path $srcRoot)) { throw "backup missing: $srcRoot" }
|
|
if (-not (Test-Path $dstRoot)) { New-Item -ItemType Directory -Path $dstRoot | Out-Null }
|
|
|
|
$copied = 0
|
|
$skipped = 0
|
|
|
|
Get-ChildItem $srcRoot -Directory | ForEach-Object {
|
|
$proj = $_.Name
|
|
$srcProj = $_.FullName
|
|
$dstProj = Join-Path $dstRoot $proj
|
|
if (-not (Test-Path $dstProj)) {
|
|
New-Item -ItemType Directory -Path $dstProj | Out-Null
|
|
}
|
|
Get-ChildItem $srcProj -Directory | ForEach-Object {
|
|
$sid = $_.Name
|
|
$dstSid = Join-Path $dstProj $sid
|
|
if (Test-Path $dstSid) {
|
|
$skipped++
|
|
return
|
|
}
|
|
Copy-Item -LiteralPath $_.FullName -Destination $dstSid -Recurse -Force
|
|
$copied++
|
|
}
|
|
}
|
|
|
|
Write-Output ("copied={0} skipped_existing={1}" -f $copied, $skipped)
|
|
Write-Output 'LIVE after restore:'
|
|
Get-ChildItem $dstRoot -Directory | ForEach-Object {
|
|
$count = @(Get-ChildItem $_.FullName -Directory -ErrorAction SilentlyContinue).Count
|
|
Write-Output (" {0} => {1}" -f $_.Name, $count)
|
|
}
|