|No worries, I actually caught that but I had changed enough stuff that once I had put in the "(" it would not execute... so it's my bad too. |
...Ok sorry for bugging you some more, but I have spent more time than I would like to admit on trying to figure this out but I'm having no luck...
This is the exact code that I'm running:
pushd "E:\Recorded TV"
for %%a in (*.xml) do (
for /f "tokens=*" %%z in ('cscript td.vbs "%%~ta" "%date:~4% %time:~0,8%"') do (
::for /f "tokens=*" %%z in ('cscript datedifftest.vbs "%%~ta" "%date:~4% %time:~0,8%"') do (
echo file: %%a, age in seconds: %%z
if %%z gtr %tlimit% del "E:\Recorded TV\%%~na.log" & del "E:\Recorded TV\%%~na.txt" & move "E:\Recorded TV\%%~na.wtv" "E:\Recorded TV\Analyzed" & move "E:\Recorded TV\%%~na.edl" "E:\Recorded TV\Analyzed" & move "E:\Recorded TV\%%a" "C:\Users\Public\DvrmsToolbox\CommercialsXml"
Everything is working except for the if statement. It will execute but it will do it no matter what the time difference is. For example if there is an XML that is 1 sec old it will still move the file even though it is not greater than 900 sec. (I actually changed this to be much greater for testing)??? I'm a little confused here, but playing around with the script (because what I really need it to do is run everything in the IF statement once the XML is done being modified, not from its creation date) it seems like my VBS script needs to be in the original XML file location (E:\Recorded TV\ in my case) not the location of the BAT file (assuming my BAT file is not in my Recorded TV directory). Is this correct? Also how are arguments(0) & arguments(1) getting populated? I'm at a loss here and that is why I cannot get my datedifftest.vbs to work (I think). I was able to see that your orignal tb.vbs script was giving me a time in seconds (why the IF statement would still execute if it were not true is beyond me though).
Thanks again for your help, and sorry for bugging you.