编写一个批处理文件删除与通配符文件 [英] Writing a batch file to delete files with wildcards

查看:482
本文介绍了编写一个批处理文件删除与通配符文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个网站在同一文件夹建立,我想创建一个批处理文件,将删除他们每个人的缓存,而无需添加一个新行每个站点。比如我使用这样的:

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\*

这工作,但我要补充一个新的生产线在 D每一个网站:\\ WWW 。 DEL命令不支持:

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?

推荐答案

我觉得这应该工作:

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

这篇关于编写一个批处理文件删除与通配符文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆