mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 17:30:05 +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:
@@ -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
|
# Steam Screenshots
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user