Xymon Mailing List Archive search

How to verify DIR content with wildcards on a Windows host?

list Zep
Tue, 17 Apr 2018 11:12:27 -0400
Message-Id: <user-d9cb8149651e@xymon.invalid>

On 04/17/2018 05:27 AM, Anaïs RABINOIT wrote:
Hi everyone,


I have to check if a directory on a windows host contains files with
a specific extension.


If it was a Unix/Linux host, i just have to write something like that
i guess :

client-local.cfg :

    file:`find /path/mydir/*.tst`

analysis.cfg :

    FILE    %(/path/mydir/*.tst)    noexist


But how to do it for a Windows host? Is this possible ?


I tried this for example :


client-local.cfg :

    file:`cmd /c "dir /b /s C:\path\mydir\*.tst"`

or

    file:`cmd /c "dir /b /s \path\mydir\*.tst"`


analysis.cfg :

    FILE    "%C:\path\mydir\*.tst"    noexist


But it doesn't work :(


Regards,


Anaïs
I'm not sure how viable it might be for your environment, but I'd
consider either installing the cygwin utilities to create a more unix
like environment or doing the heavy work with python or (for me, more
likely) perl.   either way would likely require some additional/external
tools which may have different implications for different people/groups.


C:\Users\a959784>c:\cygwin64\bin\bash.exe -c "/bin/ls /cygdrive/c/tmp/*.txt"
/cygdrive/c/tmp/snip.txt
/cygdrive/c/tmp/greenfelder.txt
/cygdrive/c/tmp/typescript.txt
/cygdrive/c/tmp/key.txt

-- 
public gpg key id: 0x5B8147CB