Review and remove explicitly identified obsolete files with minimal scope.

Sheet: 10 of 25 | Platform: Windows 10/11 | Shell: PowerShell 7.x and Windows PowerShell 5.1 (unless marked otherwise) | Editorial review: November 24, 2026

PowerShell cheat sheet index

Examples use the MGU project root and illustrative staging, backup, and download paths. Replace them with existing, approved paths as needed. Unless explicitly marked as a continuation, examples are independent. Read commands before running them; commands that write or modify files can change existing data.

Quick commands

1. Preview deleting a single obsolete file

Remove-Item -LiteralPath 'C:\MGU-Staging\obsolete.html' -WhatIf

2. List temporary files before deletion

Get-ChildItem -LiteralPath 'C:\MGU-Staging' -File -Filter '*.tmp' |
    Select-Object FullName, Length

3. Preview deleting the listed temporary files

Get-ChildItem -LiteralPath 'C:\MGU-Staging' -File -Filter '*.tmp' |
    Remove-Item -WhatIf

4. Preview removal of a specific directory tree

Remove-Item -LiteralPath 'C:\MGU-Staging\obsolete-folder' -Recurse -WhatIf

5. Require explicit confirmation for one file

Remove-Item -LiteralPath 'C:\MGU-Staging\obsolete.html' -Confirm -ErrorAction Stop

6. Verify absence after an approved deletion

Test-Path -LiteralPath 'C:\MGU-Staging\obsolete.html'

Operational notes

Remove-Item generally does not move files to the Recycle Bin. Avoid broad wildcards, -Force, and recursive deletion until the exact target and backup are verified. A False Test-Path result is not proof of how a file disappeared.

Official documentation