builtbybel / builtbybel/FluentTweaker
Windows Recent Documents doesn't seem to work
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 135
- PR merge metrics
- No merged PRs in 30d
Description
Edit: Sorry, wrong section, delete it please - this was meant to be posted on FluentCleaner
It always comes up _empty_ (tried both Classic and Modern).
I had no other option but to add the following custom cleaner (AI generated) to get the job done:
> ```
> # Fluent Cleaner Modern - Live Cleaner
> # Name: Clean Recent File Shortcuts Only
> # Description: Removes .lnk shortcuts in %APPDATA%\Microsoft\Windows\Recent that point to files or are broken.
> # Shortcuts to folders/drives are preserved.
> # Verbose logging of every deletion.
>
> param(
> [switch]$VerboseOutput
> )
>
> $recentPath = [Environment]::GetFolderPath("Recent")
> $shell = New-Object -ComObject WScript.Shell
>
> $deletedCount = 0
> $skippedCount = 0
> $errorCount = 0
>
> if (-not (Test-Path -Path $recentPath)) {
> Write-Warning "Recent folder not found: $recentPath"
> exit 1
> }
>
> Write-Host "Scanning ONLY: $recentPath"
> Write-Host "Filter: *.lnk"
> Write-Host ""
>
> Get-ChildItem -Path $recentPath -Filter "*.lnk" -ErrorAction SilentlyContinue | ForEach-Object {
> try {
> $shortcut = $shell.CreateShortcut($_.FullName)
> $targetPath = $shortcut.TargetPath
>
> # No target -> invalid shortcut -> delete
> if (-not $targetPath) {
> Remove-Item -Path $_.FullName -Force
> $deletedCount++
> if ($VerboseOutput) {
> Write-Host "[DELETED] Invalid shortcut (no target): $($_.Name)"
> }
> return
> }
>
> if (Test-Path $targetPath) {
> $item = Get-Item $targetPath -ErrorAction SilentlyContinue
>
> if (-not $item) {
> # Cannot resolve item type -> treat as broken -> delete
> Remove-Item -Path $_.FullName -Force
> $deletedCount++
> if ($VerboseOutput) {
> Write-Host "[DELETED] Unresolvable target: $($_.Name) -> $targetPath"
> }
> return
> }
>
> if ($item.PSIsContainer) {
> # Folder/Drive -> skip
> $skippedCount++
> if ($VerboseOutput) {
> Write-Host "[SKIPPED] Folder/Drive shortcut: $($_.Name) -> $targetPath"
> }
> return
> }
>
> # It's a file -> delete shortcut
> Remove-Item -Path $_.FullName -Force
> $deletedCount++
> if ($VerboseOutput) {
> Write-Host "[DELETED] File shortcut: $($_.Name) -> $targetPath"
> }
> } else {
> # Broken link (target doesn't exist) -> delete
> Remove-Item -Path $_.FullName -Force
> $deletedCount++
> if ($VerboseOutput) {
> Write-Host "[DELETED] Broken link: $($_.Name) -> $targetPath"
> }
> }
> } catch {
> $errorCount++
> Write-Warning "Error processing $($_.FullName): $($_.Exception.Message)"
> }
> }
>
> Write-Host ""
> Write-Host "Clean Recent File Shortcuts - Summary:"
> Write-Host " Deleted : $deletedCount"
> Write-Host " Skipped : $skippedCount (folders/drives)"
> if ($errorCount -gt 0) {
> Write-Host " Errors : $errorCount"
> }
> ```
Why is that?
Contributor guide
No contributing guide indexed for this repository
Research direction
No FluentTweaker files, tests, or entry points are named. First verify whether this report belongs to FluentCleaner and reproduce the empty Recent Documents result in both Classic and Modern; the issue is done only when the affected cleaner and expected behavior are clearly identified and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100