title: Batch File to do something if no new folders made within the last 24 hours?
body: <p>I am now trying to make a batch script that will run everyday and check the folder where all the files are stored. I want to check when the most recent folder (or file within the folder) was created, and if there isn't any new folders (files) in the last 24 hours, then execute this other script that I have working to alert us.</p>
  <p>But I do not know how to add before this to create/change a variable IF there is a new folder/file created within the last 24 hours.  Any help is greatly appreciated.</p>
  <p>EDIT:  I have changed my code and I am stuck here. If i remove &quot;set count=&quot; the forfiles line returns the correct number of files modified. But when i set it as set count= it starts to return 0 instead of the correct number.</p>
  <p>I also do not know if my IF statement will work yet because I have not gotten that far yet.</p>
  <pre><code>@echo off
  set day=-1
  echo &gt;&quot;%temp%\%~n0.vbs&quot; s=DateAdd(&quot;d&quot;,%day%,now) : d=weekday(s)
  echo&gt;&gt;&quot;%temp%\%~n0.vbs&quot; WScript.Echo year(s)^&amp; right(100+month(s),2)^&amp; right(100+day(s),2)
  for /f %%a in ('cscript /nologo &quot;%temp%\%~n0.vbs&quot;') do set &quot;result=%%a&quot;
  del &quot;%temp%\%~n0.vbs&quot;
  set &quot;YYYY=%result:~0,4%&quot;
  set &quot;MM=%result:~4,2%&quot;
  set &quot;DD=%result:~6,2%&quot;
  set &quot;data=%mm%/%dd%/%yyyy%&quot;
  
  set count=forfiles /S /D +%data% /C &quot;cmd /C if @isdir==FALSE echo _&quot; | find /C &quot;_&quot;
  
  IF count = 0 powershell.exe -file C:\User\Project\action.ps1
  </code></pre>