We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

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


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


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


In cPanel & WHM version 76 and later, when you disable the File Storage role, the system disables this function.


 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.


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.


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

 cPanel Tag System (deprecated)


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


  • 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:


 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>


ParameterTypeDescriptionPossible valuesExample

The files' directory.

This value defaults to /home.

Any valid directory./user


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.

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

This value defaults to select.html.

Any valid filename.select.html


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

Any valid HTML page name.seldir.html


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.


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