Search code examples
windowscmddel

Windows command line - Remove files with specific extension, but not ones where extension contains substring (doc not docx)


I'm using wordconv.exe to convert a bunch of a old doc files into docx. Afterwards I'd like to delete the original doc files.

When I run "del /S *.doc" on the command line it deletes both the doc and docx files. Anyway to get it to delete just .doc files?

Thanks!


Solution

  • Let's try to use something like this:

    forfiles /s /m *.doc /c "cmd /c del @file"