mercredi 25 février 2015

Batch file - Deleting files with a name matching this regex OR that regex but NOT that one

I try to write a Windows batch file to delete all files in a directory matching ((regex1 or regex2) and not regex3).


I'm able to delete files matching a regular expression using something like:



for /f "tokens=*" %%a in (
'dir /a-d /b *.* ^| findstr /r /c:"^test[0-9]*.jar$"'
) do del "%%a"


But I have no idea how I can say :



  1. this regex or this one.

  2. but not this one


Aucun commentaire:

Enregistrer un commentaire