From d6e3b899b5a6b496c14cf7d16a1bd10ff7cd208c Mon Sep 17 00:00:00 2001 From: Jeffrey <9938813+Raphire@users.noreply.github.com> Date: Mon, 8 Jun 2026 23:20:17 +0200 Subject: [PATCH] Clean up Get.ps1, Get-Dev.ps1 --- Scripts/Get-Dev.ps1 | 20 +++++++++++++------- Scripts/Get.ps1 | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Scripts/Get-Dev.ps1 b/Scripts/Get-Dev.ps1 index 19901e8..4605e29 100644 --- a/Scripts/Get-Dev.ps1 +++ b/Scripts/Get-Dev.ps1 @@ -133,12 +133,12 @@ catch { Exit } -Write-Output "" -Write-Output "> Cleaning up old Win11Debloat folder..." - -# Remove old script folder if it exists, but keep config and log files +# Remove old script folder if it exists, but keep configs, logs and backups if (Test-Path $tempWorkPath) { - Get-ChildItem -Path $tempWorkPath -Exclude CustomAppsList,LastUsedSettings.json,Win11Debloat.log,Config,Logs,Backups | Remove-Item -Recurse -Force + Write-Output "" + Write-Output "> Cleaning up old Win11Debloat folder..." + + Get-ChildItem -Path $tempWorkPath -Exclude Config,Logs,Backups | Remove-Item -Recurse -Force } $configDir = Join-Path $tempWorkPath 'Config' @@ -146,6 +146,9 @@ $backupDir = Join-Path $tempWorkPath 'ConfigOld' # Temporarily move existing config files if they exist to prevent them from being overwritten by the new script files, will be moved back after the new script is unpacked if (Test-Path "$configDir") { + Write-Output "" + Write-Output "> Backing up existing config files..." + New-Item -ItemType Directory -Path "$backupDir" -Force | Out-Null $filesToKeep = @( @@ -176,6 +179,9 @@ if (Test-Path "$backupDir") { New-Item -ItemType Directory -Path "$configDir" -Force | Out-Null } + Write-Output "" + Write-Output "> Restoring existing config files..." + Get-ChildItem -Path "$backupDir" -Recurse | Move-Item -Destination "$configDir" Remove-Item "$backupDir" -Recurse -Force } @@ -216,13 +222,13 @@ if ($null -ne $debloatProcess) { $debloatProcess.WaitForExit() } -# Remove all remaining script files, except for CustomAppsList and LastUsedSettings.json files +# Remove all remaining script files, except for configs, logs and backups if (Test-Path $tempWorkPath) { Write-Output "" Write-Output "> Cleaning up..." # Cleanup, remove Win11Debloat directory - Get-ChildItem -Path $tempWorkPath -Exclude CustomAppsList,LastUsedSettings.json,Win11Debloat.log,Win11Debloat-Run.log,Config,Logs,Backups | Remove-Item -Recurse -Force + Get-ChildItem -Path $tempWorkPath -Exclude Config,Logs,Backups | Remove-Item -Recurse -Force } Write-Output "" diff --git a/Scripts/Get.ps1 b/Scripts/Get.ps1 index 076969d..9ded2a1 100644 --- a/Scripts/Get.ps1 +++ b/Scripts/Get.ps1 @@ -172,7 +172,7 @@ Expand-Archive $tempArchivePath $tempWorkPath Remove-Item $tempArchivePath # Move files -Get-ChildItem -Path (Join-Path $tempWorkPath 'Raphire-Win11Debloat-*') -Recurse | Move-Item -Destination $tempWorkPath +Get-ChildItem -Path (Join-Path $tempWorkPath '*Win11Debloat-*') -Recurse | Move-Item -Destination $tempWorkPath # Add existing config files back to Config folder if (Test-Path "$backupDir") {