@echo off
TITLE SFTP_UPLOAD
mode con:cols=40 lines=10
@SetLocal enabledelayedexpansion

set Source=C:\SFTPSource


:loop
cls
echo %date% %time%
echo checking source
timeout /t 5 /nobreak > NUL
@for /F "tokens=1" %%a IN ('Dir "%Source%\*.mp4" /-C/S/A:-D') Do @Set number_of_files=!n2! & Set /a n2=%%a
if %number_of_files% == 0 (goto loop)



cls
echo %date% %time%
echo uploading to SFTP...

for /f "tokens=1* delims=[]" %%G in ('dir /A-D /B "%Source%\*.mp4" ^| find /v /n ""') do (

C:\Apps\WinSCP\winscp.com /script=C:\Apps\sftpscriptonline.txt


    del /q /f "%Source%\%%~nxH" > NUL
)
goto loop