Child pages
  • cPanel API 1 Functions - Fileman::listfiles
Skip to end of metadata
Go to start of metadata

Description

This function lists a directory's files, permissions, and some display options.

Warning:

cPanel API 1 is deprecated. Do not use this function. Instead, we strongly recommend that you use the following newer functions:

Important:

In cPanel & WHM version 76, the FileStorage role affects this function.

Examples


 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$list_files = $cpanel->api1('Fileman', 'listfiles', array('public_html', '1', select.html', 'seldir.html', '0')); // Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $list_files = $cpliveapi->api1('Fileman', 'listfiles' ['public_html', '1', select.html', 'seldir.html', '0']); # Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Tag System (deprecated)


Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We provide this example to help developers move from the old cPanel tag system to our LiveAPI system. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

<cpanel Module="Fileman::listfiles ( $FORM('dir','chooser','select','dirselect','usesameframe'))">
 Command Line
cpapi1 --user=username Fileman listfiles public_html 1 select.html seldir.html 0


Notes:

  • You must URI-encode these values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to cPanel API 1 documentation or run the cpapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the cpapi1 command:

    /usr/local/cpanel/bin/api/cpapi1

 Output (HTML)
<table width=\"100%\"><tr><td><a href=\"?dir=%2fhome%2fexampleuser%2fexample.com/\"><img src=\"../mimeicons/httpd-unix-directory.png\" border=0></a></td><td><a href=\"?dir=/\">/</a> <a href=\"?dir=/dink5.com%2f\">example.com</a> /  (Current Folder)</a>\n</td><td></td><td></td></tr>\n <tr><td><a href=\"?dir=%2fhome%2fexampleuser%2f\"><img src=\"../mimeicons/httpd-unix-directory.png\" border=\"0\"></a></td><td><a href=\"?dir=%2fhome%2fexampleuser%2f\"><b>Up one level</b></a></td><td></td><td></td></tr>\n<tr><td><a href=\"?dir=%2fhome%2fexampleuser%2fexample.com/assets\"><img src=\"../mimeicons/httpd-unix-directory.png\" border=\"0\"></a></td><td><a href=\"dirselect=index.html?dir=%2fhome%2fexampleuser%2fexample.com&file=assets\">assets</a></td><td></td><td>755</td></tr>
...
</table>

Parameters

ParameterTypeDescriptionPossible valuesExample
dirstring

The files' directory.

This value defaults to /home.

Any valid directory./user
chooserBoolean

Required

Whether to print extra links to upload files, and create files and new folders.

  • 0 — Print files with extra links.
  • 1 — Print files without extra links.
1
selectstring

The file's arguments to link to a specified HTML page.

This value defaults to select.html.

Any valid filename.select.html
dirselectstring

Required

The HTML page to which to send the specified files' arguments.

Any valid HTML page name.seldir.html
usesameframeBoolean

Required

Whether to create links that open selected files in a new browser window.

  • 0 — Create links that open selected files in a new window.
  • 1 — Create links that open selected files in the same window.
1

Returns

This function returns the specified directory's files, permissions, and display options in HTML format.