Hello
I'm trying the "Folder sensor". I want to make sure that a folder is empty. I cannot see a way to not count hiden files like Thumbs.db. At this point I cannot use the default sensor, it does not fit my needs. Why isn't there a setting to allow to not scan hidden files ? :-( It seems to me really basic setting.
https://www.paessler.com/manuals/prtg/folder_sensor "The Folder sensor counts all files in a folder, including hidden files."
I suppose I'll have to write my own script?
Thank you
Yann
Article Comments
Custom Sensor NetworkFileCount allows you to count files in a folder and optional subfolders while skipping hidden files.
Jan, 2018 - Permalink
Well thank you for this last answer.
I already spent hours to setup "Folder sensor" :-( I'll try for antoher case and I probably swtich later to this sensor if it works as expected.
Feb, 2018 - Permalink
As NetworkFileCount is a custom script, I prefered use my own. Really simple, do exactly what I need and no more. Can be easily modified to suit your needs.
Get-ChildItem by default does not return hidden file.
param( [string]$computerName, [string]$p_folderToCheck ) $session = New-PSSession -computerName $computerName -Authentication Kerberos $scriptBlock = { param( $p_folderToCheck ) $fileCount = gci -File $p_folderToCheck $fileCount = $fileCount.count $result= "<?xml version=`"1.0`" encoding=`"Windows-1252`" ?>`r`n" $result+="<prtg>`r`n" $result+=" <result>`r`n" $result+=" <channel>Nb fichier</channel>`r`n" $result+=" <Unit>count</Unit>`r`n" $result+=" <value>$fileCount</value>`r`n" $result+=" </result>`r`n" $result+=" <text>OK</text>`r`n" $result+="</prtg>`r`n" $result } Invoke-Command -computerName $computername -scriptBlock $scriptBlock -ArgumentList $p_folderToCheck Remove-PSSession -computerName $computername Exit 0
Feb, 2018 - Permalink
Hello,
Thank you for the KB-Post. I'm afraid indeed, as of now this can only be solved with a script running as a custom sensor. I'll forward the improvement request to our dev team though.
best regards.
Jan, 2018 - Permalink