Description:
With this object, you can make or read the contents of a directory on the server system.
Members:
fileCount - Returns the number of items in the directory
Methods:
Directory($path) - Constructor fileCount() - Returns the number of items in the directory getEntry($num) - Returns the file or directory name associated with the given number mkDir($dir_name) - Creates a new directory in the directory.
Example:
// Prints the items in the /tmp directory
$a = new Directory("/tmp");
for($i=0;$i<$a.fileCount();$i = $i + 1){
print($a.getEntry($i),"\n");
}| Member name: fileCount | Class Directory |
Description:
Returns the number of items in the directory.
| Member name: Directory($path) | Class Directory |
Description:
Creates a new directory object and reads the contents of the directory $path if available. If $path does not exist, $dir.filecount is set to 0.
Usage:
$dir = new Directory($path);
| $dir | - | Reference to the new Directory object |
| $path | - | Starting directory path (directory to read) |
| Member name: fileCount() | Class Directory |
Description:
Returns the number of items in the directory.
Usage:
$count = $dir.fileCount();
| $count | - | The number of items in the directory |
| Member name: getEntry($num) | Class Directory |
Description:
Returns the file or directory name associated with the given number.
Usage:
$name = $dir.getEntry($num);
| $name | - | The file or directory name |
| $num | - | The item number (between 0 and $dir.fileCount() - 1) |
| Member name: mkDir($dir_name) | Class Directory |
Description:
Creates a new directory in the directory.
Usage:
$dir.mkDir($dir_name);
| $dir_name | - | Name of new directory to be made |