Writing a batch file to delete files using wildcards

I have several websites configured in one folder, and I want to create a batch file that will delete the cache in each of them, without having to add a new line for each site. For example, I use this:

del /S /QD:\www\site-name\cache\* 

Which works, but I have to add a new line for each site in D:\www . The del command does not support:

 del /S /QD:\www\*\cache\* 

So what is the best way to do this?

+7
wildcard dos batch-file
source share
1 answer

I think this should work:

 for /D %%f in ("D:\www\*") do @( del /S /Q "%%f\cache\*" ) 
+12
source share

All Articles