删除子目录超过30天 [英] Delete sub directories older than 30 days

查看:85
本文介绍了删除子目录超过30天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个批处理脚本,将删除所有子目录这是超过30天。
我真的很新的批量脚本所以我只是希望有人能帮助我在这。

I'm trying to create a batch script that will delete all sub directories which are older than 30 days. I'm really new to batch scripting so I'm just hoping that someone can help me out on this.

我能找到一个脚本,删除指定位置的所有子目录。

I was able to find a script that delete all sub directories in specified location.

@for /f "tokens=*" %%a in ('dir /s /b "C:/temp/test" 2^>NUL') do rd /s /q "%%a"

有人可以调整这个脚本,它仅删除这是30天的目录?

Can someone tweak this script so it deletes only directories which are 30 days old?

推荐答案

假设你被限制在批处理文件...的检查这个 - 但是如果你可以使用VBScript,我想你可以做一个<一个href=\"http://itknowledgeexchange.techtarget.com/system-administration/vbscript-to-delete-files-in-a-directory-older-than-x-days/\"相对=nofollow>好一点。

Assuming you are restricted to batch files... check this - but if you can use VBScript, I think you can do a bit better.

现在你已经澄清你真正的问题,请大家明白,如果你想用System.exec(),您将有充足的弊端作斗争。

Now that you have clarified your real problem, please understand that if you meant to use System.exec() you will have to contend with plenty of drawbacks.

另外,如果你真的想使用JNDI(你提到的原生,但并不清楚你的意思),也许这将有所帮助:的 http://mindprod.com/products1.html#FILETIMES

Alternatively if you really want to use JNDI (you mention "native" but don't make clear what you mean) maybe this will be of help: http://mindprod.com/products1.html#FILETIMES

这篇关于删除子目录超过30天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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