Core Function GetFolders

From Sputnik Wiki
Jump to: navigation, search
GetFolders ( <path>, <pattern> )

Contents

Description

Get an array of all folders in a directory.

Parameters

path

The path to use.

"" means current directory.

pattern

Optional; The regex search pattern to use OR the regular text based search pattern to use

Return Value

Success: Returns array of folders.

Failure: Returns empty array.

Remarks

None

Example

Get all folders in current folder

$fList = GetFolders("");
foreach($fList as $folder)
{
	println($folder);
}

Get all folders in windows folder

$fList = GetFolders("c:\\windows");
foreach($fList as $folder)
{
	println($folder);
}

Get all folders in current folder that begin with s have none or more alphabetical chars and end with nik

$fList = GetFolders("", m/s\w*nik/);
foreach($fList as $folder)
{
	println($folder);
}

Get all folders in current folder that contain the text cat

$fList = GetFolders("", "cat");
foreach($fList as $folder)
{
	println($folder);
}

Get all folders in current folder that contain the text cat or the text dog

$fList = GetFolders("", m/(cat)|(dog)/);
foreach($fList as $folder)
{
	println($folder);
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox