Script checking for last line text (recursive)
Posted: 18 Dec 2016 09:26
Hi all,
I an noobie in batch scripting and I would appreciate if you could help me.
I want to create a script which reads a root path (windows path or svn path),
checking only the .sql files which are inside "Packages" and "Package Bodies" folders.
The script I would like to check if the last line of the .sql file is "/".
When the script changes folder print *******
Could you help me please ?
Thanks in advance
I an noobie in batch scripting and I would appreciate if you could help me.
I want to create a script which reads a root path (windows path or svn path),
checking only the .sql files which are inside "Packages" and "Package Bodies" folders.
The script I would like to check if the last line of the .sql file is "/".
When the script changes folder print *******
Could you help me please ?
Thanks in advance
Code: Select all
@echo off&cls
setlocal enabledelayedexpansion
set initialPath=%~dp0
set /p rootPath=Path :
cd %rootPath%
for %%a in (*.sql) do (
for /f "delims=" %%b in ('type "%%a"') do (
set "$Line=%%b"
)
if not "!$Line:~-1!"=="/" (
echo %%~nxa [!$Line:~-1!] =^> Not valid
) else (
echo %%~nxa [!$Line:~-1!] =^> OK
)
echo.^**************
)
cd %initialPath%
:End
endlocal
pause >nul