0

My script should work as follows: Check whether or not there are DAV files in the folder, if there are NO elements for a 1 minute loop until the next check, and if there are any DAV files, it should trigger DAV to JPEG conversion and move JPEGs to the SNAPSHOT folder, and DAV for PROCESSED folder. Until it works, the problem is finishing the conversion to JPEG and moving the files to folders, it closes the script, and it goes back to the loop and waits for a new file, this is not happening.

Another problem is also that the files are generated every 30 minutes in bulk, but they already appear in bulk and therefore end when the 30 minutes are over, or the problem is when the script ends or the script just moves to one. PROCESSED folder, and does not convert.

Script:

REM -  - Checks for New Files (*.DAV).

:LOOP01    
     IF EXIST "C:\Users\AudicomRede\Documents\SNAPSHOT FINAL\TESTE VERIFICAÇÃO\*.*" GOTO SKIP01


:LOOP02
     IF NOT EXIST "C:\Users\AudicomRede\Documents\SNAPSHOT FINAL\TESTE VERIFICAÇÃO" GOTO SKIP02

     REM - ALL THIS WILL BE DONE IF THE DAV FILE EXISTS
:
:
:SKIP01
    REM Crafty 1 minute delay...
       PING 1.1.1.1 -n 10 -w 6000 >NUL
           GOTO LOOP01
:
:
:SKIP02
    REM START CONVERT
       for %%A IN (*.dav) do (

            ffmpeg -i "%%A" -r 0.2 -bt 20M -s 480x300 "%%~nA"%%03d.jpg

                  Move "%%A" PROCESSED
                      Move "*.*" SNAPSHOT 
                          
)

 GOTO SKIP01

I use FFMPEG to convert all files.

Mark Rotteveel
  • 82,132
  • 136
  • 114
  • 158
AUDICOM
  • 3
  • 3
  • 2
    shouldn't `Move "*.*" SNAPSHOT` be `Move "*.jpg" SNAPSHOT`? (currently, you also move `.dav` files) – Stephan Oct 01 '19 at 17:49
  • You are first checking if there are **any** files rather than `*.dav` only. Then you are checking whether the directory `TESTE VERIFICAÇÃO` exists, so `:SKIP02` will probably never be reached... – aschipfl Oct 01 '19 at 19:05
  • Your "crafty delay" is the old way. Try ***timeout.exe*** for a more elegant solution. – Señor CMasMas Oct 01 '19 at 21:30
  • Thanks for the help, but I resolved otherwise, just removed the pause command and redirected to the loop and it worked. – AUDICOM Oct 02 '19 at 17:32

0 Answers0