I need to check, preferably in one single test, if several specific files are present, and send a mail with the names of the missing files.
For one single file I am using the Folder/File Availability test. What would you suggest for several - a dozen - files.
Thanks
Alex
Presence of several files (or shares)
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Hm. Interesting request 
I think, you may use Shell script test method.
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
To make it work you should write cmd script as combination of "for", "find" and "dir" commands.
I think, you should create a text file, that would contain the mandatory present filenames. Then you should loop over each file name in that file using "for" command:
Also you should assign Send-email action to "Bad" action profile. In mail template you may use <<IncludeFile=missed_files.log>> syntax to unclude missed_files.log as attachment.
http://www.ks-soft.net/hostmon.eng/mfra ... .htm#Mails
Of course, foregoing script was written as an example, and may not work, but you may adjust it on your own.
Regards,
Max

I think, you may use Shell script test method.
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell
To make it work you should write cmd script as combination of "for", "find" and "dir" commands.
I think, you should create a text file, that would contain the mandatory present filenames. Then you should loop over each file name in that file using "for" command:
Code: Select all
for /f "eol=; tokens=*" %%i in ('type list.txt') do (
DIR %specific_Folder% | find %%i > NUL
IF ERRORLEVEL 1 (
echo %%1 >> missed_files.log
)
)
rem Now we should check if missed_files.log is not empty
type missed_files.log > NUL
IF ERRORLEVEL 1 (
ScriptRes:Ok:Ok
) ELSE (
ScriptRes:Bad:Bad
)
http://www.ks-soft.net/hostmon.eng/mfra ... .htm#Mails
Of course, foregoing script was written as an example, and may not work, but you may adjust it on your own.
Regards,
Max