Search for file names containing (0-9) in windows
To find all file names containing (1).
or (2).
you can search for:
name:(~"*(1).*") OR name:(~"*(2).*")
Also, (from comments) you can more simply match a single character between parenthesis with:
name:(~"*(?).*")
This will work in your case if you are sure that you only have numbers between the ()
.
What about using a batch file to find all files with (x)
and build a revisable Kill-List from the results?
- The following batch will exactly do this
- the search starts in the folder defined with the variable
Base
- the results are stored in a file on the desktop including a random number.
- the results file is opened with notepad.exe to remove possible errants.
- finally you are asked if you want to execute the deletes.
@Echo off&SetLocal
Set "Base=%USERPROFILE%"
Set "Report=%USERPROFILE%\Desktop\Kill-List_%Random%.cmd"
( For /f "delims=" %%F in (
'dir /B/S "%Base%\*(?).*"^|findstr "([0-9])\.[^\.]*$" '
) Do Echo Del "%%F"
) > "%Report%"
Start "" Notepad.exe "%Report%"
Set "DoDel="
Set /P "DoDel=Do you want to execute the revised Kill-List ? [y/n]: "
If /i "%DoDel%" Equ "y" "%Report%"
Sample results file:
Del "C:\Users\UserName\AppData\Local\Microsoft\UserScanProfiles\SCANPROFILE (2).XML"
Del "C:\Users\UserName\AppData\Local\Microsoft\Windows Sidebar\settings (2).ini"
Del "C:\Users\UserName\AppData\Roaming\Microsoft\Office\Recent\mytest.csv (2).LNK"
Del "C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Recent\Neu (2).lnk"
Del "C:\Users\UserName\Desktop\Programm_Links\VLC media player (2).lnk"
Del "C:\Users\UserName\OneDrive\Bilder\Screenshots\2016-09-15 (1).png"
Del "C:\Users\UserName\OneDrive\Bilder\Screenshots\2016-09-15 (2).png"
Del "C:\Users\UserName\Pictures\Screenshots\Screenshot (1).png"