-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoUpdater.bat
38 lines (31 loc) · 919 Bytes
/
autoUpdater.bat
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
35
36
37
38
@echo off
title auto update Android Studio to Git
color 1F
ECHO File updater app
ECHO Close app when done coding/editting related files.
:: Replace <filePath>
SET CURRENT_FILE_1="<filePath>"
SET CURRENT_FILE_2="<filePath>"
SET FILE_TO_UPDATE_1="<filePath>"
SET FILE_TO_UPDATE_2="<filePath>"
:LOOP
FOR %%i IN (%CURRENT_FILE_1%) DO SET DATE_1=%%~ti
FOR %%i IN (%FILE_TO_UPDATE_1%) DO SET DATE_2=%%~ti
IF "%DATE_1%" NEQ "%DATE_2%" GOTO UPDATE_FILE_1
:CONTINUE
FOR %%i IN (%CURRENT_FILE_2%) DO SET DATE_1=%%~ti
FOR %%i IN (%FILE_TO_UPDATE_2%) DO SET DATE_2=%%~ti
IF "%DATE_1%" NEQ "%DATE_2%" GOTO UPDATE_FILE_2
GOTO WAIT
:WAIT
:: wait 1 minute before checking again
ping -n 61 localhost >nul 2>nul
GOTO LOOP
:UPDATE_FILE_1
:: copy file1 to file2 /y
copy %CURRENT_FILE_1% %FILE_TO_UPDATE_1% /y
GOTO CONTINUE
:UPDATE_FILE_2
:: copy file1 to file2 /y
copy %CURRENT_FILE_2% %FILE_TO_UPDATE_2% /y
GOTO WAIT