How do I search and delete duplicate files and folders containing (1) or (2) in their names?


folder(1), folder(2), file(1).exe, file(2).jpg ...

I need to delete such files and folders. Please advise.

  • You can use for /R with del or rd command to find and delete simultaneously. – Biswapriyo Jun 3 '17 at 16:57
  • All the solutions provided below work only for files and not for folders. – josh Jun 5 '17 at 13:27
  • name:(~"*(?)") searches for folders – josh Jun 5 '17 at 13:34

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:


This will work in your case if you are sure that you only have numbers between the ().

  • Search for name:(~"*(?).*") to get any single digit result, so all results are multiple copies. – LPChip Jun 3 '17 at 16:10
  • wow! Stephen Rauch, you are Amazing! I couldnt find this stuff even on google...how did you learn this man. – josh Jun 5 '17 at 12:51
  • Oops,spoke too soon... that only worked for files and not for folders... – josh Jun 5 '17 at 13:26
  • Worked after I changed the search to name:(~"*(?)") – josh Jun 5 '17 at 13:33

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 "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"
  • Would this work for folders? – josh Jun 5 '17 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.