Hello I have a log file that I am creating and updating every hour, it runs a lot of files therefore it fills up very quickly.
What I want to do is to purge every once in a while only leaving the last 30 lines of the file.
I have been trying to do this for a while I know there is the "More" command that can print the lines from the n line. What I want is to use that command or something similar but instead of printing it I want it to write to a file.
This is what I got so far.
set LINES=0
for /f "delims==" %%I in (test2.txt) do (
set /a LINES=LINES+1
)
@echo
set /a LINES=LINES-30
more +%LINES% < test2.txt