We all know that whenever we run the vugen script some replay files will be created in the vugen script folder and the size of the folder will get increased. If we keep running the tests without deleting these unwanted replay files at one point we might come across the disk space issue in the LG or controller where loadrunner scripts are being maintained.
So the below command prompt script will delete these replay files across all the vugen scripts your project has. All you to do is to keep save the below code as .cmd file and keep it in the main parent folder where you have all your vugen scripts and run it at the end of every test which will maintain only the run time files in the vugen script.
Note - the below script is an upgraded version of the previous code which I have shared in this post -
http://vinothperformancetesting.blogspot.com/2017/12/reducing-vugen-scripts-folder-size-by.html
Script Code:
cls
echo
echo
echo This batch file will delete the following files from every
echo folder and subdirectory from the folder in which it is run: -
echo
echo *.idx
echo mdrv*.log
echo mdrv.txt
echo options.txt
echo *.ci
echo combined_*.c
echo output.txt
echo debug.inf
echo *.bak
echo \result1
echo
REM Append Current Date & Time to Filename
set CUR_YYYY=%date:~10,4%
set CUR_MM=%date:~4,2%
set CUR_DD=%date:~7,2%
set CUR_HH=%time:~0,2%
if %CUR_HH% lss 10 (set CUR_HH=0%time:~1,1%)
set CUR_MM=%time:~3,2%
set CUR_SS=%time:~6,2%
set CUR_MS=%time:~9,2%
set CURTIMESTAMP=%CUR_DD%%CUR_MM%%CUR_YYYY%-%CUR_HH%%CUR_MM%%CUR_SS%
REM These lines create blank files for later file comparisons.
type nul > %cd%\blankfile_%CURTIMESTAMP%.txt
type nul > %cd%\FilesDeleted_%CURTIMESTAMP%.txt
REM These del functions delete the unwanted LoadRunner files and pipe any output into the %cd%\FilesDeleted_%CURTIMESTAMP%.txt file.
del *.idx /s >> "%cd%\FilesDeleted.txt"
del mdrv*.log /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del mdrv.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del options.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.ci /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del combined_*.c /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del output.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del debug.inf /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.bak /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.ini /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.db /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.ci /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.pickle /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.tmp /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.sdf /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.log /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
REM This deletes any sub-folders called result1
FOR /d /r . %%d IN ("result1") DO @IF EXIST "%%d" rd /s /q "%%d"
REM If FilesDeleted.txt, FoldersDeleted.txt or BadParms.txt exist, open them up in Notepad so we can see them.
fc %cd%\FilesDeleted_%CURTIMESTAMP%.txt %cd%\blankfile_%CURTIMESTAMP%.txt > nul
if errorlevel 1 "Notepad.exe" "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
REM This deletes all the folders with name events inside the data subfolder
FOR /d /r . %%i IN ("events*") DO @IF EXIST "%%i" rd /s /q "%%i"
FOR /d /r . %%j IN ("http*") DO @IF EXIST "%%j" rd /s /q "%%j"
REM Delete *.log/*.dat/*.txt/*.inf/*.ini/*json files inside the data subfolder
FOR /D /R %%G IN ("data") DO (
IF EXIST %%G CD %%G
IF EXIST *.c (
DEL *.log /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.dat /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.inf /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.ini /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.json /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.css /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.html /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.gif /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.htm /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.ico /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.jpg /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.png /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.svg /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.xml /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
)
)
So the below command prompt script will delete these replay files across all the vugen scripts your project has. All you to do is to keep save the below code as .cmd file and keep it in the main parent folder where you have all your vugen scripts and run it at the end of every test which will maintain only the run time files in the vugen script.
Note - the below script is an upgraded version of the previous code which I have shared in this post -
http://vinothperformancetesting.blogspot.com/2017/12/reducing-vugen-scripts-folder-size-by.html
Script Code:
cls
echo
echo
echo This batch file will delete the following files from every
echo folder and subdirectory from the folder in which it is run: -
echo
echo *.idx
echo mdrv*.log
echo mdrv.txt
echo options.txt
echo *.ci
echo combined_*.c
echo output.txt
echo debug.inf
echo *.bak
echo \result1
echo
REM Append Current Date & Time to Filename
set CUR_YYYY=%date:~10,4%
set CUR_MM=%date:~4,2%
set CUR_DD=%date:~7,2%
set CUR_HH=%time:~0,2%
if %CUR_HH% lss 10 (set CUR_HH=0%time:~1,1%)
set CUR_MM=%time:~3,2%
set CUR_SS=%time:~6,2%
set CUR_MS=%time:~9,2%
set CURTIMESTAMP=%CUR_DD%%CUR_MM%%CUR_YYYY%-%CUR_HH%%CUR_MM%%CUR_SS%
REM These lines create blank files for later file comparisons.
type nul > %cd%\blankfile_%CURTIMESTAMP%.txt
type nul > %cd%\FilesDeleted_%CURTIMESTAMP%.txt
REM These del functions delete the unwanted LoadRunner files and pipe any output into the %cd%\FilesDeleted_%CURTIMESTAMP%.txt file.
del *.idx /s >> "%cd%\FilesDeleted.txt"
del mdrv*.log /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del mdrv.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del options.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.ci /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del combined_*.c /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del output.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del debug.inf /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.bak /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.ini /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.db /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.ci /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.pickle /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.tmp /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.sdf /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
del *.log /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
REM This deletes any sub-folders called result1
FOR /d /r . %%d IN ("result1") DO @IF EXIST "%%d" rd /s /q "%%d"
REM If FilesDeleted.txt, FoldersDeleted.txt or BadParms.txt exist, open them up in Notepad so we can see them.
fc %cd%\FilesDeleted_%CURTIMESTAMP%.txt %cd%\blankfile_%CURTIMESTAMP%.txt > nul
if errorlevel 1 "Notepad.exe" "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
REM This deletes all the folders with name events inside the data subfolder
FOR /d /r . %%i IN ("events*") DO @IF EXIST "%%i" rd /s /q "%%i"
FOR /d /r . %%j IN ("http*") DO @IF EXIST "%%j" rd /s /q "%%j"
REM Delete *.log/*.dat/*.txt/*.inf/*.ini/*json files inside the data subfolder
FOR /D /R %%G IN ("data") DO (
IF EXIST %%G CD %%G
IF EXIST *.c (
DEL *.log /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.dat /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.txt /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.inf /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.ini /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.json /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.css /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.html /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.gif /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.htm /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.ico /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.jpg /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.png /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.svg /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
DEL *.xml /s >> "%cd%\FilesDeleted_%CURTIMESTAMP%.txt"
)
)