-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprepare.bat
48 lines (41 loc) · 988 Bytes
/
prepare.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
39
40
41
42
43
44
45
46
47
48
@echo off
setlocal enabledelayedexpansion
:: Variables
set ROOT_DIRECTORY=%~dp0
set EXCLUDING_FOLDERS=node_modules dist venv .git $git $ out bin
set EXCLUDING_VALUES=FALCION PATTERNU PATTERNUGIT PATTERNUGIT.NET
:: Logging functions
:info
echo [INFO] %~1
goto :eof
:error
echo [ERROR] %~1
goto :eof
:: Search function
:search
set "filepath=%~1"
echo Searching in %filepath%
for %%target in (%EXCLUDING_VALUES%) do (
findstr /i %%target "%filepath%" >nul
if !errorlevel! == 0 (
echo Found "%%target" in %filepath%
)
)
goto :eof
:: Traverse function
:traverse
set "directory=%~1"
echo Traversing directory: %directory%
for /r "%directory%" %%f in (*) do (
echo Processing file: %%f
call :search %%f
)
goto :eof
:: Main script
set /p mode="Do you want to update the settings? Y/N/IGNORE: "
if /i "%mode%" neq "IGNORE" (
set /p params="Enter words separated by a comma: "
echo Updating settings with: %params%
)
call :traverse %ROOT_DIRECTORY%
pause