Child pages
  • UAPI Functions - Fileman::autocompletedir

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt
This function returns any files and directories that begin with a specified string.

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledFileStorageRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titlecPanel or Webmail Session URL


Code Block
languagetext
https://hostname.example.com:2083/cpsess##########/execute/Fileman/autocompletedir?path=public&dirs_only=1&list_all=0&html=1

Include Page
LIB:_CallUAPIFromBrowserLink
LIB:_CallUAPIFromBrowserLink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Search for directories that begin with public.
$search_directories = $cpanel->uapi(
    'Fileman', 'get_file_content',
		array(
		'path'			=> 'public',
		'dirsonly'		=> '1',
		'list_all'		=> '0',
        'html'          => '1'
 )
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Search for directories that begin with public.
my $ search_directories = $cpliveapi->uapi(
 	'Fileman', 'autocompletedir',
		{
		'path'			=> 'public',
		'dirsonly'		=> '1',
 		'list_all'		=> '0',
        'html'          => '1'
		}
 );

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Template Toolkit


Code Block
languagexml
linenumberstrue
<!-- Search for directories that begin with public. -->
[% data = execute(
   'Fileman', 'autocompletedir', {
        'path'        => 'public',
        'dirs_only'   => '1',
        'list_all'    => '0',
        'html'        => '1'
   }
); %]

Include Page
LIB:_TTLink
LIB:_TTLink


Expand
titleCommand Line


Code Block
languagebash
uapi --user=username Fileman autocompletedir path=public dirs_only=1 list_all=0 html=1

Include Page
LIB:_UAPICLINote
LIB:_UAPICLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{  
   "data":[  
      {  
         "file":"public_html"
      },
      {  
         "file":"public_ftp"
      },
      {  
         "file":"public.html"
      }
   ],
   "messages":null,
   "metadata":{  
      "transformed":1
   },
   "status":1,
   "errors":null
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParametersTypeDescriptionPossible valuesExample
pathstring

Required

The prefix of the paths to complete.

A valid string.public
dirsonlystring

Whether to include only directories in the output.

This parameter defaults to 0.

  • 1Only include directories.
  • 0 — Include directories and files.
1
list_allstring

Whether to return all files and directories inside the specified directory.

If you set this parameter's value to 1, you must set the path parameter's value to a full directory path.

This parameter defaults to 0.

  • 1 — Return all files and directories inside the specified directory.
  • 0 — Return partial file and directory name matches.

0

htmlBoolean

Whether to return HTML-encoded results.

Note
titleNote:

We added this parameter in cPanel & WHM version 72.

This parameter defaults to 1.

  • 1 — Return HTML-encoded output.
  • 0 — Return plaintext output.
1

Returns

ReturnTypeDescriptionPossible valuesExample
 array of hashesAn array of hashes that contains the files and directories that match the specified path.This array of hashes includes the file return. 

file

string

A file or directory that matches the specified path.

The function returns this value in the unnamed array of hashes.

A valid filename or directory name.public_ftp