根据时间戳过滤目录
我的最终目标是:删除目录中早于给定日期的所有内容。
我愿意实现的是删除与今天的日期相比超过 7 天的所有备份目录。我可以根据操作系统时间戳(Windows 2003)或保存创建日期的目录名称来检查目录。
我知道我必须处理,但我想知道最好的方法,如果这个命令可以为我过滤这些文件,因为它最初必须对日期进行一些基本计算。
任何帮助/指示将不胜感激。
干杯 /J
My ultimate goal is the following : delete all content from a directory that is older than a given date.
What I'm willing to achieve is removing all backup directories that are more than 7 days old compared to today's date. I could check the directories based on their OS timestamp (Windows 2003) or the directory name which holds the date it has been created at.
I know I'll have to deal with but I'm wondering on the best way to do that, if this command can filter these files for me, since it initially has to do some basic computation on dates.
Any help / directions will be greatly appreciated.
Cheers
/J
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Ant 仅提供非常有限的日期处理支持。我建议要么编写一个小型 Java 程序(< 40 行代码),要么使用像 Python。或者 PowerShell(如果已安装)。
Ant has only very limited date handling support. I suggest to either write a small Java program (< 40 lines of code) or use a scripting language like Python. Or PowerShell if it's already installed.