modified date filter in batch script?

2019-07-18 19:27发布

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
)

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?

Thanks.

JR

1条回答
Anthone
2楼-- · 2019-07-18 19:52

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 %%#
 )
查看更多
登录 后发表回答