#native_company# #native_desc#


By Chris Heilmann
on October 15, 2001

Version: 1.0

Type: Function

Category: File Management

License: GNU Library Public License

Description: load”$”,8

reads the contents of a passed directory and returns an array with the filenanes.
Allows you to apply filters for certain filetypes.

	Function directory($directory,$filters)
	written by Chris Heilmann ([email protected]) 
        reads the content of $directory, takes the files that 
        apply to $filter and returns an array of the filenames.
	You can specify which files to read, for example
	$files = directory(".","jpg,gif");
		gets all jpg and gif files in this directory.
	$files = directory(".","all");
		gets all files.
function directory($dir,$filters){
	if ($filters == "all"){
        while(($file = readdir($handle))!==false){$files[] = $file;}}
	if ($filters != "all"){
		while (($file = readdir($handle))!==false) {
			for ($f=0;$f<sizeof($filters);$f++):
				if ($system[1] == $filters[$f]){$files[] = $file;}
	return $files;