New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Folder sensor

Votes:

0

Your Vote:

Up

Down

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

folder-sensor hidden-file settings

Created on Jan 26, 2018 2:29:01 PM by  Yann (150) 1 1



Best Answer

Accepted Answer

Votes:

1

Your Vote:

Up

Down

Custom Sensor NetworkFileCount allows you to count files in a folder and optional subfolders while skipping hidden files.

Created on Jan 30, 2018 9:51:24 AM by  PRTG Tools Family [prtgtoolsfamily.com] (12,865) 3 4



4 Replies

Votes:

0

Your Vote:

Up

Down

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.

Created on Jan 29, 2018 1:19:11 PM by  Torsten Lindner [Paessler Support]



Accepted Answer

Votes:

1

Your Vote:

Up

Down

Custom Sensor NetworkFileCount allows you to count files in a folder and optional subfolders while skipping hidden files.

Created on Jan 30, 2018 9:51:24 AM by  PRTG Tools Family [prtgtoolsfamily.com] (12,865) 3 4



Votes:

0

Your Vote:

Up

Down

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.

Created on Feb 1, 2018 2:49:38 PM by  Yann (150) 1 1



Votes:

0

Your Vote:

Up

Down

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

Created on Feb 9, 2018 10:35:34 AM by  Yann (150) 1 1

Last change on Feb 9, 2018 3:07:34 PM by  Torsten Lindner [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.