-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWaitForEditsToFinish.bat
More file actions
34 lines (29 loc) · 977 Bytes
/
WaitForEditsToFinish.bat
File metadata and controls
34 lines (29 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@echo off
REM Configuration Variables
set search_dir=.\TestDir
set wait_seconds=5
set search_mask=*.*
REM Descriptive Output
set start_time=%date%
echo Script started at %date% %time%
echo Waiting until %search_mask% files in %search_dir% stop changing for %wait_seconds% seconds...]
echo.
REM pseudocode
REM while last_edit_time != modif_time:
REM last_edit_time = modif_time
REM modif_time = latest edit time within directory
set last_edit_time=24:60:60
:loop
REM modif_time = latest edit time within directory
for /f "delims=" %%i in ('"forfiles /p %search_dir% /m %search_mask% /c "cmd /c echo @ftime" "') do set modif_time=%%i
REM Base case
if "%modif_time%" == "%last_edit_time%" (
goto exitloop
)
set last_edit_time=%modif_time%
timeout /t %wait_seconds% /nobreak > NUL
goto loop
:exitloop
REM Descriptive Output
echo Last edit in %search_dir% occured at %last_edit_time%
echo Script finished at %date% %time%