This article documents the usage of the Cpanel::Fileman::listfiles function in relation to the cPanel interface. This tag can be used inside cPanel pages.
Cpanel::Fileman::listfiles
This function lists all files in a specific directory.
- dir (string)
-
Absolute path to the directory to be listed.
- showdotfiles (string)
-
Whether or not to show files that begin with a '.'
- needmime (string)
-
Set this to 1 if MIME info result is needed.
- types (string)
-
Comma seperated list of file types. If sepecified, will only return files of those types. (file|dir|special)
- filelist (string)
-
Comma seperated list of files to list. Format: filelist=filename.ext,file2.ext,file3.ext
- path (string)
-
Absolute path to the file.
- file (string)
-
Name of the file. format: file.extension
- type (string)
-
Type of the file (used for iconic representations).
- size (string)
-
Size of the file in Bytes.
- mtime (string)
-
When file was last modified. Format: UNIX time
- humansize (string)
-
Size of the file in MB.
- nicemode (string)
-
File mode attributes in human readable form. ex. 0644
- ctime
-
Time of the creation of the file. Format: UNIX time
- mode
-
File mode (from stat()).
- gid
-
Group ID associated with the file. Format: group
- uid
-
User ID associated with the file. Format: user
- mimeinfo
-
Returns the mime type (uses much CPU power).
<?cp Fileman::listfiles(
[name]%[/name]
[path]%[/path]
[humansize]%[/humansize]
,^file,^path,^humansize) dir=/home/user/public_html/ ?>
This example will list the name, path to, and size of (in MB) all the files in the directory /home/user/public_html/
Copyright 2007 cPanel Inc.