批处理脚本中修改日期过滤器? [英] modified date filter in batch script?

查看:89
本文介绍了批处理脚本中修改日期过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理脚本,它完全按照我想要的去做,只是想让它一直运行,但是为了做到这一点,需要确保它所选择的文件没有被使用.最简单的方法就是说,如果修改后的日期在3个小时内没有变化,那就很好了.所以我有这个电话:

I have a Batch script that is doing exactly what I want it to, would just like to have it running all the time, but in order to do so need to make sure the files it's selecting aren't in use. Easiest way to do that is to say if the modified date hasn't changed in 3 hours it's good. So I have this call:

for %%f in ("d:\recorded tv\*.wtv") do (
 REM do stuff
)

有什么想法要修改上面的内容,说给我录制的电视文件夹中属于WTV扩展名且至少在3个小时内没有被修改的所有内容吗?

Any idea how to modify the above to say give me everything that is a WTV extension in the Recorded TV folder and that hasn't been modified in at least 3 hours?

谢谢.

JR

推荐答案

很久以前,我写了

Long ago I've wrote a script that can filters the files by their times. Though it is not extensively tested you can try it:

for /f "tokens=* delims=" %%# in ('
  FileTimeFilterJS.bat "d:\recorded tv\" -hh -3 -direction before -filetime accessed ^|
  find /i ".wtv"
') do (
  REM do stuff with %%#
 )

这篇关于批处理脚本中修改日期过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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