Skip to content

Get File Count

This operation returns the number of files and optionally directories located in the specified path. Additional options include:

  • pattern filtering - counts files and directories which match the pattern.
  • recursive counting - when enabled, counts all matching files and directories while recursively traversing the directory structure.
Future<int> Backendless.files.getFileCount(String path, [String pattern, bool recursive, bool countDirectories]);

where:

Argument                Description
path path of a directory in the Backendless files storage starting with /
pattern a glob pattern to match files which should be counted.
recursive if set to true, recursively count matching files in all subdirectories.
countDirectories if set to true, count directories in addition to files.

Example

Backendless.files.getFileCount("/web", "*.html", true).then((count) {
  print("File count: $count");
});