46

Windows 10 shows a list of recent files in the explorer. Is there a possibility to exclude certain folders (recursively) from being shown in this list?

5 Answers5

8

This problem was bugging me too. Turns out, this is ridiculously simple. Bear with me.

You let Windows pick up the unwanted files and/or folders in the recent list, then go to Quick Access (make sure recent files and folders are displayed!), and simply right click and remove. And voilá - Windows will never add the same file or folder again to any list of recent files. Never. They won't even appear in the right click menu of Windows Explorer. Remove from quick access

This automated global "ban list" in Windows is reset if you clear File Explorer history (Folder Options / General)

Now I would love to know if that is possible to somehow manually edit this "ban list", and add folders to it. I couldn't figure out a way to do this yet.

vacip
  • 631
7

There is no built-in capability to exclude a folder and all its files and subfolders from Recent Items. You can only hide individual files, after-the-fact, and removing folders from Quick Access does not prevent files contained in them from being added to Recent Items.

To address this limitation of Windows, Bitsum developed a small app named Recent Files Exclusions. It works by monitoring the recent items list and pruning it of excluded files in real-time.

dyasta
  • 450
5

Directly from File Explorer (exploring shell:recent folder in address bar): just use the search box at the top-right of the window and type something like

  • -linktarget:d:\bat\ to hide all links to files/folders in the d:\bat\ folder, i.e. matching d:\bat\* criterion;
  • -linktarget:d:\bat\a to hide all links to files/folders matching d:\bat\a* criterion;
  • -linktarget:"d:\bat\a b" (note that path with spaces are enclosed in double quotes);
  • -(kind:Link;Folder linktarget:"d:\bat\a b)" (hides only folders but shows files).

Resources:

The Advanced Query Syntax (AQS) is used by Microsoft Windows Desktop Search (WDS) to help users and programmers better define and narrow their searches. Using AQS is an easy way to narrow searches and deliver better result sets. Searches can be narrowed by the following parameters:

  • File kinds: folders, documents, presentations, pictures and so on.
  • File stores: specific databases and locations.
  • File properties: size, date, title and so on.
  • File contents: keywords like "project deliverables," "AQS," "blue suede shoes," and so on.

Furthermore, search parameters can be combined using search operators...


Honestly, I do not know any method to prevent creating links to particular items in the shell:recent folder. However, if you want delete particular links from there as soon as possible, then adapt any of next scripts for your purposes (keep in mind that files in the shell:recent folder are all links (shortcuts):

JosefZ
  • 13,855
3

This PowerShell works great for me.

  • You can set a list of paths to monitor.
  • The script will make an initial cleanup, then continue to monitor to delete any new file.
  • You can set a Task Scheduler to run it every time you logged in.
  • In case you need a one time cleanup, just remove the last 3 lines.
# Paths to monitor
$targetPaths = @(
    "c:\users\user\videos",
    "c:\users\user\photos"
    # Add more as needed
)

$recentFolder = [System.IO.Path]::Combine($env:APPDATA, 'Microsoft\Windows\Recent')

function DeleteItem($itemPath) { Write-Host "Deleting item: $itemPath" Remove-Item -LiteralPath $itemPath -Force }

Delete existing shortcuts on init

Get-ChildItem -Path $recentFolder -Filter "*.lnk" | ForEach-Object { $link = (New-Object -ComObject WScript.Shell).CreateShortcut($.FullName) foreach ($targetPath in $targetPaths) { if ($link.TargetPath -like "$targetPath*") { DeleteItem $.FullName break } } }

FileSystemWatcher to monitor changes in the folder

$watcher = New-Object System.IO.FileSystemWatcher $watcher.Path = $recentFolder $watcher.Filter = "*.lnk" # Monitor only shortcut files

Event action

$action = { $file = $Event.SourceEventArgs.FullPath Write-Host "Shortcut detected: $file"

$link = (New-Object -ComObject WScript.Shell).CreateShortcut($file)
foreach ($targetPath in $targetPaths) {
    if ($link.TargetPath -like "$targetPath\*") {
        DeleteItem $file
        break  # Break out of the loop if a match is found
    }
}

}

Register events

Register-ObjectEvent $watcher 'Created' -Action $action Register-ObjectEvent $watcher 'Changed' -Action $action

Write-Host "Monitoring shell:recent"

while ($true) { Start-Sleep -Seconds 5 }

Yehuda
  • 256
1

Open Windows Explorer, Click View tab on the top windows, click option at upper right side the windows, at General tab untick Show recently used files in Quick access and Show frequently used folder in Quick access, then click Clear button.

enter image description here

Jusup
  • 697