countSubDirs

abstract fun countSubDirs(parent: String? = null): UInt

Returns a count of first level subdirectories directly under the given parent directory name.

Examples

For these examples our object container is a bucket named "my-bucket".

Given contents of "my-bucket":

/foo/bar.txt
/bazz.txt
/fizz/buzz/flamingo.txt
/fizz/buzz/grapes.png

If we run the command:

container.countSubDirs()

The result will be 2, as at the root of the container the direct subdirectories are my-bucket/foo/ and my-bucket/fizz/.

If we run the command:

container.countSubDirs("foo")

The result will be 0 as the path my-bucket/foo/ contains no direct subdirectories.

If we run the command:

container.countSubDirs("fizz")

The result will be 1 as the path my-bucket/fizz/ contains the direct subdirectory ./buzz/

Return

A count of subdirectories under either the object container root or under the given path prefix.

Parameters

parent

Name of the parent directory under which the subdirectories will be listed.

If this value does not point to an existing directory, this method will return 0.

Throws

If this bucket or the bucket in which this object container resides no longer exists.

If an implementation specific exception is thrown. The implementation specific exception will be set to the thrown exception's 'cause' value.