John
John

Reputation: 61

modified date filter in batch script?

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

Upvotes: 2

Views: 710

Answers (1)

npocmaka
npocmaka

Reputation: 57262

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 %%#
 )

Upvotes: 1

Related Questions