1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 12:41:46 +00:00

feat: add Windows screenshots and screen recordings cleanup

- Add Pictures\Screenshots path (Snipping Tool/Snip & Sketch)
- Add Videos\Screen Recordings path (Windows 11 screen recorder)
- Both use age-based cleanup (>90d by default)
This commit is contained in:
Bhadra
2026-01-12 20:48:33 +05:30
parent 3dccf3592f
commit ba8ec9ef34

View File

@@ -505,6 +505,36 @@ function Clear-GameMediaFiles {
}
}
# -------------------------------------------------------------------------
# Windows Snipping Tool / Snip & Sketch Screenshots
# -------------------------------------------------------------------------
$windowsScreenshotsPath = "$env:USERPROFILE\Pictures\Screenshots"
if (Test-Path $windowsScreenshotsPath) {
foreach ($ext in @('*.png', '*.jpg', '*.jpeg', '*.gif', '*.bmp')) {
$oldFiles = Get-ChildItem -Path $windowsScreenshotsPath -Filter $ext -File -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -lt $cutoffDate }
if ($oldFiles) {
$paths = $oldFiles | ForEach-Object { $_.FullName }
Remove-SafeItems -Paths $paths -Description "Windows screenshots (>${DaysOld}d)"
}
}
}
# -------------------------------------------------------------------------
# Windows Screen Recordings (Snipping Tool / Win+Alt+R)
# -------------------------------------------------------------------------
$windowsRecordingsPath = "$env:USERPROFILE\Videos\Screen Recordings"
if (Test-Path $windowsRecordingsPath) {
foreach ($ext in @('*.mp4', '*.mkv', '*.avi', '*.mov', '*.wmv')) {
$oldFiles = Get-ChildItem -Path $windowsRecordingsPath -Filter $ext -File -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -lt $cutoffDate }
if ($oldFiles) {
$paths = $oldFiles | ForEach-Object { $_.FullName }
Remove-SafeItems -Paths $paths -Description "Windows screen recordings (>${DaysOld}d)"
}
}
}
# -------------------------------------------------------------------------
# Steam Screenshots
# -------------------------------------------------------------------------