C<m> (megabyte), C<g> (gigabyte), C<t> (terabyte), and C<p> (petabyte). Please
note that there are 1000 bytes in a kilobyte, not 1024.
+=item B<Recursive> I<true>|I<false>
+
+Controls whether or not to recurse into subdirectories. Enabled by default.
+
=back
=head2 Plugin C<filter_pcre>
#include <dirent.h>
#include <fnmatch.h>
+#define FC_RECURSIVE 1
+
struct fc_directory_conf_s
{
char *path;
char *instance;
+ int options;
+
/* Data counters */
uint64_t files_num;
uint64_t files_size;
return (0);
} /* int fc_config_add_dir_size */
+static int fc_config_add_dir_recursive (fc_directory_conf_t *dir,
+ oconfig_item_t *ci)
+{
+ if ((ci->values_num != 1)
+ || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
+ {
+ WARNING ("filecount plugin: The `Recursive' config options needs exactly "
+ "one boolean argument.");
+ return (-1);
+ }
+
+ if (ci->values[0].value.boolean)
+ dir->options |= FC_RECURSIVE;
+ else
+ dir->options &= ~FC_RECURSIVE;
+
+ return (0);
+} /* int fc_config_add_dir_recursive */
+
static int fc_config_add_dir (oconfig_item_t *ci)
{
fc_directory_conf_t *dir;
fc_config_set_instance (dir, dir->path);
+ dir->options = FC_RECURSIVE;
+
dir->name = NULL;
dir->mtime = 0;
dir->size = 0;
status = fc_config_add_dir_mtime (dir, option);
else if (strcasecmp ("Size", option->key) == 0)
status = fc_config_add_dir_size (dir, option);
+ else if (strcasecmp ("Recursive", option->key) == 0)
+ status = fc_config_add_dir_recursive (dir, option);
else
{
WARNING ("filecount plugin: fc_config_add_dir: "
return (-1);
}
- if (S_ISDIR (statbuf.st_mode))
+ if (S_ISDIR (statbuf.st_mode) && (dir->options & FC_RECURSIVE))
{
status = walk_directory (abs_path, fc_read_dir_callback, dir);
return (status);