0
Answered

Can I monitor when any file exceeds 1.8GB in a specified directory?

abeta 7 years ago updated by Konstantin (Here to help) 7 years ago 3

Can I monitor when any file exceeds 1.8GB in a specified directory?

I assume your question is "Can I monitor when any file exceeds 1.8GB in a specified directory?" If so - yes. You need to use custom shell monitor and use the following shell command:

ls -al --block-size=1M /your-directory | gawk "{ print \$5 }" | sort -n | tail -1

This will give you the size of the biggest file in /your-directory in Mb. Then you only need to put 1800 as a threshold.

Let me know if you have any more questions.

Thanks for the help. I am getting the following error message when executing the command:


'ls' is not recognized as an internal or external command,operable program or batch file.


Am I doing something wrong here?


Funny thing. I didn't realize you use Windows. In this case you will need to play with powershell. Try smth like this: 

powershell -Command "gci .  | sort Length -desc | select Length -f 1 | ft -HideTableHeaders"

Use gci . -r if you need recursive directory scan.

Let me know whether it will work.