Core Function GetFolders

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
UberFoX (Talk | contribs)
(Created page with "<pre> GetFolders ( <path>, <pattern> ) </pre> === Description === Get an array of all folders in a directory. === Parameters === ==== path ==== The path to use. "" means cu...")
Newer edit →

Revision as of 20:51, 9 December 2011

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 $file)
{
	println($file);
}

Get all folders in windows folder

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

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 $file)
{
	println($file);
}

Get all folders in current folder that contain the text cat

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

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

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