Directory Functions | |
---|---|
chdir() | |
bool chdir(string $sNewDirectory) | |
This function changes the current directory to $sNewDirectory. It returns TRUE, if it is successful. Otherwise, it returns FALSE. | |
Argument | Description |
string $sNewDirectory | This is the directory that will become the current one. |
chroot() | |
bool chroot(string $sNewDirectory) | |
This function changes the root directory of the current process to $sNewDirectory and the current directory to "/". This function is strictly for unix. It returns TRUE, if it is successful. Otherwise, it returns FALSE. | |
Argument | Description |
string $sNewDirectory | This is the directory that will become the root directory. |
closedir() | |
void closedir(resource $qDirStream = qLast) | |
This function closes the directory stream $qDirStream. | |
Argument | Description |
resource $qDirStream | This is the directory stream that will be closed. |
dir() | |
Directory dir(string $sDirectory, resource $qContext = default) | |
This function returns a Directory object for the directory $sDirectory and opens it. If the parameters are incorrect, it returns NULL. If it fails for some other reason, it returns FALSE. | |
Argument | Description |
resource $qDirStream | This is the directory stream that will be closed. |
resource $context | This is a resource context created by stream_context_create(). |
dirname() | |
string dirname(string $sPath, int $iLevels = 1) | |
This function returns the path to the ancester directory $iLevels up from the file or directory path specified by $sPath. By default, the number of levels is 1, or the parent directory. If there are no slashes in $sPath, the function returns a '.' to indicate the current directory. | |
Argument | Description |
string $sPath | This is the path of the file or directory. |
int $iLevels | This is number of directory levels up to return. |
getcwd() | |
string getcwd() | |
This function returns the current directory, if it is successful. Otherwise, it returns FALSE. | |
is_dir() | |
bool is_dir(string $sPath) | |
This function returns TRUE, if $sPath is a directory. Otherwise, it returns FALSE. | |
Argument | Description |
string $sPath | This is the path that will be checked. |
mkdir() | |
bool mkdir(string $sNewDirPath, int $iMode = 0777, bool $bRecursive = false, resource $qContext = default) | |
This function creates a new directory at $sNewDirPath and returns TRUE, if it is successful. Otherwise, it returns FALSE. | |
Argument | Description |
string $sNewDirPath | This is the directory path for the directory that will be created. |
int $iMode | This is an octal number that defines the access mode for the directory. It does not apply on windows. |
bool $bRecursive | This specifies whether directories should be created down the entire path. |
resource $context | This is a resource context created by stream_context_create(). |
opendir() | |
resource opendir(string $sDirPath, resource $qContext = default) | |
This function opens a directory stream to $sDirPath and returns it $sNewDirPath, if it is successful. Otherwise, it returns FALSE. | |
Argument | Description |
string $sDirPath | This is the directory path for the directory stream that will be created. |
resource $context | This is a resource context created by stream_context_create(). |
readdir() | |
string readdir(resource $qDirectory = last) | |
This function returns the next entry in the directory specified by $qDirectory, if it is successful. Otherwise, it returns FALSE. If no directory is supplied, the last one is used. | |
Argument | Description |
resource $qDirectory | This is the directory stream whose contents will be read. |
rewinddir() | |
void rewinddir(resource $qDirectory = last) | |
This function moves the stream pointer for the directory stream specified by $qDirectory to the beginning. If no directory is supplied, the last one is used. | |
Argument | Description |
resource $qDirectory | This is the directory stream whose stream pointer will be moved. |
rmdir() | |
bool rmdir(string $sDirPath, resource $qContext = default) | |
This function removes the directory at $sDirPath and returns TRUE, if it is successful. Otherwise, it returns FALSE. Note that the directory must be empty before it is removed. | |
Argument | Description |
string $sDirPath | This is the directory path for the directory that will be removed. |
resource $context | This is a resource context created by stream_context_create(). |
scandir() | |
array scandir(string $sDirPath, int $iOrder = SCANDIR_SORT_ASCENDING, resource $qContext = default) | |
This function returns an array of the names of files and directories inside the directory at $sDirPath, if it is successful. Otherwise, it returns FALSE. The files and directories inside the array are sorted according to $iOrder as follows:
|
|
Argument | Description |
string $sDirPath | This is the directory path for the directory whose contents will be returned. |
int $iOrder | This is order in which the contents will be returned. |
resource $context | This is a resource context created by stream_context_create(). |
© 20072024 XoaX.net LLC. All rights reserved.