Writing a batch file to delete files with wildcards

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 13:04:26

问题


I have multiple websites set up in the same 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 am using this:

del /S /Q D:\www\site-name\cache\*

Which works, but I have to add a new line for every site in D:\www. The del command doesn't support:

del /S /Q D:\www\*\cache\*

So what is a better way to do this?


回答1:


I think this should work:

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


来源:https://stackoverflow.com/questions/2556778/writing-a-batch-file-to-delete-files-with-wildcards

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!