Count files including subfolders using fileinfo

Hi,

I have a system with general path like /var/spool/postfix/deferred. Within this path there are folders like:
0
1
2
3
A
B
C
etc.
In advance can not know if there will be sometime also folder D or 5.
But my request is to count all existing files which are possible in the any of these directories below the base folder /var/spool/postfix/deferred. Is it possible to achieve that with exiting plugin as fileinfo?

Regards,
Matjaž

IMHO you can just use “*” in place of the subfolder.
/var/spool/postfix/deferred/*/

Under Windows this works, i am not sure if it works same way under linux.

Hi,

I tried this. With “" it works just for one folder.
With the last “slash /” after the "
” it’s not working on Linux.

Regards,
Matjaž

What do you mean with “one folder”?
Under Windows i use it

d:\*\*\*.txt

that will find all Files with Suffix txt in all folders two subdirectories deep. So may you have to give the path in a way like

/var/spool/postfix/deferred/*/*.*
or
/var/spool/postfix/deferred/*/*/*.*

You may try

/var/spool/postfix/deferred/**/*

EDIT: I Forgot the trailing star. It works the same way in Linux and UNIX:

From glob (programming) - Wikipedia

Hi,

Yes for one specific level, where are more directories I’ve managed with
/var/spool/postfix/deferred//.*. Count works properly also on Linux.

Thanks,
Matjaž

This is correct.

Regards,
Matjaž

1 Like

Is this just an example or is your ultimate aim really to monitor the postfix deferred queue? There already is a “Postfix Queue” check, with separate counts for active and deferred.

Hi,

Yes I know about the “Postfix Queue” check. But in my case I have appliance from TrendMicro appliance, which is based also on Postfix, but as I saw they’re using other folders for configuration files and I don’t know how to change existing “Postfix Queue” to work in my case.

Regards,
Matjaž

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.