Sunteți pe pagina 1din 4

Delete unwanted files and results

folders from LoadRunner script


folders
Its a common complaint of IT chaps supporting performance test teams that
their script folders are large (especially if youve been running scripts with
logging enabled for debugging purposes). Lots of files can be deleted before
you save or archive your scripts which saves disk space and generally keeps
things tidier.
The batch file (tidyup.cmd) attached to this article can help you to tidy up
your LoadRunner script folder. It deletes unwanted log files and output files.
The following files are deleted.
mdrv.log
mdrv_cmd.txt
options.txt
pre_cci.c
.ci
combined_.c
output.txt
debug.inf
All files with .idx extension
All files with .bak extension
The Result1 folder and its contents

It is also possible to delete RecordingLog.txt file in the scriptdata folder. If


you delete this file, it will not affect the scripts replay. However, you will not
be able to see the information about what happened during recording.

Batch file tidyup.cmd

Description of action

IF EXIST %temp%blankfile.txt del %temp


%blankfile.txt /q
IF EXIST %temp%FilesDeleted.txt del
%temp%FilesDeleted.txt /q
IF EXIST %temp%FoldersDeleted.txt del
%temp%FoldersDeleted.txt /q
IF EXIST %temp%BadParms.txt del %temp
%BadParms.txt /qtype nul > %temp
%blankfile.txt
type nul > %temp%FilesDeleted.txt
type nul > %temp%FoldersDeleted.txt
type nul > %temp%BadParms.txt

These lines delete any existing files from


previous runs of this batch file.These lines
create blank files for later file
comparisons.These del functions delete the
unwanted LoadRunner files and pipe any
output into the %temp%FilesDeleted.txt file.

del *.idx /s >> %temp%FilesDeleted.txt

exists

This for loop deletes any sub-folders called


result1 and pipes any output into the %temp
%FoldersDeleted.txt file.
This deletes the local result1 directory if it

del mdrv*.log /s >> %temp%FilesDeleted.txt


del mdrv.txt /s >> %temp%FilesDeleted.txt

This function looks for explicit file paths rather

del options.txt /s >> %temp%FilesDeleted.txt

than relative file paths in the .PRM files and

del *.ci /s >> %temp%FilesDeleted.txt

writes them to the %temp%BadParameters.txt

del combined_*.c /s >> %temp

file.

%FilesDeleted.txt
del output.txt /s >> %temp%FilesDeleted.txt

If FilesDeleted.txt exists, open it in

del debug.inf /s >> %temp%FilesDeleted.txt

Notepad.exe wo we can see the names of

del *.bak /s >> %temp%FilesDeleted.txt

deleted files.

for %%d in (h) do (

If FoldersDeleted.txt exists, open it in

for /f delims= %%a in (dir/s/b/ad %CD

Notepad.exe wo we can see the names of

%result*) do (

deleted folders.

echo deleted %%a >> %temp


%FoldersDeleted.txt

If BadParameters.txt exists, open it in

rd /s /q %%a

Notepad.exe wo we can see the names of

parameters that dont use relative file paths

(and are less portable).

rd result1 /s /q

Finally delete the superfluous temporary files.

findstr /S :\ *.prm > %temp%BadParms.txt


fc %temp%FilesDeleted.txt %temp
%blankfile.txt > nul
if errorlevel 1 Notepad.exe %temp
%FilesDeleted.txt
fc %temp%FoldersDeleted.txt %temp
%blankfile.txt > nul
if errorlevel 1 Notepad.exe %temp
%FoldersDeleted.txt
fc %temp%BadParameters.txt %temp
%blankfile.txt > nul
if errorlevel 1 Notepad.exe %temp
%BadParms.txt
IF EXIST %temp%blankfile.txt del %temp
%blankfile.txt /q
IF EXIST %temp%FilesDeleted.txt del
%temp%FilesDeleted.txt /q
IF EXIST %temp%BadParms.txt del %temp
%BadParms.txt /q

This batch file can be run either from within a script folder, or from a top-level folder containing
multiple LoadRunner scripts. If run in a top level folder it loops through all sub-folders deleting
files and results folders as it goes. In both cases, the list of deleted files and folders is displayed
using notepad.exe .
Some of my colleagues prefer to have a copy of the tidyup.cmd batch file in all their script
folders and some prefer ro run it from the top level folder. If you want a copy of tidyup.cmd in
all your sub-folders the copytidy.cmd file can be used to copy the batch file to multiple subfolders.
Batch file copytidy.cmd

Description of action

for %%d in (h) do (

For each sub folder identified by the

for /f delims= %%a in (dir /a:D

dir /a:D /b command.

/b) do (

Copy the tidyup.cmd command into

copy %%a tidyup.cmd

the folder.

)
)

S-ar putea să vă placă și