How to delete files containing certain string using batch file in Windows?

chance picture chance · Dec 15, 2011 · Viewed 18.3k times · Source

My Panasonic camera uses its stupid PHOTOfunSTUDIO to import photos. It creates folders by the name of the date when photos are taken, and imports photos into those folders respectively. So far so good. But If I import again before removing all old pictures from camera, the old ones will be imported again by adding a name suffix (002),(003),..., no mater how I change the settings of that software.

My question: how to remove all the files that having name suffixes from those folders?

For example, this is one folder:

D:\Photos\2011\2011-12-01>dir  /b
20111201_184550(002).cont
20111201_184550(002).iis
20111201_184550(002).m2ts
20111201_184550(002).tmb
20111201_184550.cont
20111201_184550.iis
20111201_184550.m2ts
20111201_184550.tmb

Answer

chance picture chance · Dec 15, 2011

OK, maybe I was stupid. It does not need any batch:

del /s *(00?).*