Description
This function lists a directory's files and their attributes.
Warning:
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
checkleaf |
Boolean |
Whether to add the isleafparameter to the output key. This parameter defaults to 0. |
|
1 |
dir |
string |
The directory. This parameter defaults to the user's/home directory. |
A valid directory name. |
public_html |
filelist |
Boolean |
Whether to search for keys that begin with filepath-*. This parameter defaults to 0. |
|
1 |
filepath-* |
string |
Which files to list with the output, if the filelist parameter is 1. Each key indicates a file to view. This parameter defaults to an empty string. |
Any valid filename. |
filepath-myfile |
needmime |
Boolean |
Whether to return the mimenameand mimetype parameters. This parameter defaults to 0. |
|
1 |
showdotfiles |
Boolean |
Whether to add dotfiles to the output keys. This parameter defaults to 0. |
|
1 |
types |
string |
The types of files to return. If you do not use this parameter, the function returns all file types. |
One or more valid file types, separated by pipe characters. |
dir|file |
Returns
Return |
Type |
Description |
Possible values |
Example |
ctime |
integer |
The file's creation time. |
A Unix time stamp. |
1371711650 |
uid |
integer |
The file owner's user ID. |
A valid user ID on the server. |
User |
mode |
string |
The file's permissions. |
A set of file permissions, intextual representationformat. |
16877 |
mtime |
integer |
The file's last modification time. |
A Unix time stamp. |
1411211655 |
isleaf |
Boolean |
Whether the domain contains subdirectories. |
|
1 |
mimename |
string |
The file's MIME name. |
A valid MIME name. |
homeb |
file |
string |
The file's name. |
A valid filename. |
public_html |
path |
string |
The path to the file. |
A valid absolute file path. This value does not include the file or directory name. |
/home/example/cpbackup-exclude.conf |
nicemode |
integer |
The file's permissions. |
A set of file permissions, inoctal notation format. |
0777 |
humansize |
string |
The formatted size of the file. |
A positive integer and a unit of measure in Megabytes (MB), Kilobytes(KB), or Gigabytes (GB). |
4KB |
size |
integer |
The size of the file. |
A positive integer, in bytes. |
4096 |
fullpath |
string |
The path to the file. |
An absolute file path thatincludes the file or directory name. |
home/user/public_html |
type |
string |
The item type. |
|
file |
mimetype |
string |
The file's MIME type. |
A valid MIME type. |
text/plain |
gid |
integer |
The file owner's system group ID. |
A positive integer. |
508 |
reason |
string |
A reason for failure. Note: This function only returns a reasonvalue if an error occurred. |
A string that describes the error. |
This is an error message. |
result |
Boolean |
Whether the function succeeded. |
|
1 |