Skip to content

Commit

Permalink
update function of add current folder back
Browse files Browse the repository at this point in the history
  • Loading branch information
fsdrw08 authored Jan 29, 2022
1 parent a667313 commit 4fc9e87
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Scoop/Backup-Scoop.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ if ((Read-Host "Are you sure all scoop apps had closed? y/N") -eq "y") {
. (Join-Path $Destination "7z.exe") a $Destination\Scoop.7z $env:USERPROFILE\scoop\

"add the current folder back"
Get-ChildItem "$env:USERPROFILE\scoop\apps\" | Select-Object -ExpandProperty fullname | ForEach-Object {
if ((Get-ChildItem $_ | Select-Object -ExpandProperty name) -notcontains "current") {
$Target = Get-ChildItem $_ | Select-Object -First 1 | Select-Object -ExpandProperty fullname
New-Item -ItemType Junction -Path "$_\current" -Target $Target
}
}
scoop reset *

"Backup done, please enter to close the window"
Expand All @@ -49,4 +55,4 @@ if ((Read-Host "Are you sure all scoop apps had closed? y/N") -eq "y") {

} else {
"close the running scoop apps first"
}
}

0 comments on commit 4fc9e87

Please sign in to comment.