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
  • UAPI Functions - DirectoryIndexes::list_directories
Skip to end of metadata
Go to start of metadata

Description

This function returns the directory indexing settings of the subdirectories in a directory.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/DirectoryIndexes/list_directories?dir=/home/example/example.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Retrieve a list of indexed directories for the /home/example/example.com directory.
$list_directories = $cpanel->uapi(
    'DirectoryIndexes', 'list_directories',
    array(
        'dir'    		   => '/home/example/example.com',
  )
);


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.
 
// Retrieve a list of indexed directories for the /home/example/example.com directory.
my $list_directories = $cpliveapi->uapi(
    'DirectoryIndexes', 'list_directories',
    {
        'dir'   		   => '/home/example/example.com',
    }
);


Note:

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

 

 Command Line
uapi --user=username DirectoryIndexes list_directories dir=/home/example/example.com


Notes:

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

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
  "errors": null,
  "metadata": {
    
  },
  "messages": null,
  "status": 1,
  "warnings": null,
  "data": {
    "current": {
      "state": {
        "index_type": "inherit",
      },
      "path": "/home/example/example.com"
    },
    "home": {
      "state": {
        "index_type": "inherit",
      },
      "path": "/home/example"
    },
    "parent": {
      "path": "/home/example",
      "state": {
        "index_type": "inherit",
      }
    },
    "children": [
      {
        "state": {
          "index_type": "inherit",
        },
        "path": "/home/example/example.com/example"
      }
    ]
  }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
dirstring

Required

The directory for which to return indexing information.

A valid absolute directory path./home/example/example.com

Returns

ReturnTypeDescriptionPossible valuesExample
currenthashThe user's current directory and its indexing information.This hash contains the state hash and path return.

state

hash

The current directory's indexing information.

The function returns this value in the current hash.

This hash contains the index_type return.

index_type

string

The current directory's indexing type.

The function returns this value in the state hash.

  • standard — The directory uses directory indexing with standard formatting.
  • disabled — The directory doesn't use directory indexing.
  • inherit — The directory uses the system's default settings.
  • fancy —  The directory uses directory indexing with Apache® FancyIndexing directive. The directory will include additional information such as file size and the date of the file's last update.
inherit 

path 

string

The current directory's path.

The function returns this value in the current hash.

A valid absolute directory path.

/home/example/example.com 
home hashThe user's home directory and its indexing information.This hash contains the state hash and path return.

state 

hash

The home directory's indexing information.

The function returns this value in the home hash.

This hash contains the index_type return.

index_type

string

The home directory's indexing type.

The function returns this value in the state hash.

  • standard — The directory uses directory indexing with standard formatting.
  • disabled — The directory doesn't use directory indexing.
  • inherit — The directory uses the system's default settings.
  • fancy —  The directory uses directory indexing with Apache® FancyIndexing directive. The directory will include additional information such as file size and the date of the file's last update.
inherit 

path 

string

The home directory's path.

The function returns this value in the home hash.

A valid absolute directory path./home/example 
parent hashThe parent directory of the current directory and its indexing information.This hash contains the state hash and path return.

state 

hash

The parent directory's indexing information.

The function returns this value in the parent hash.

This hash contains the index_type return.

index_type

string

The parent directory's indexing type.

The function returns this value in the state hash.

  • standard — The directory uses directory indexing with standard formatting.
  • disabled — The directory doesn't use directory indexing.
  • inherit — The directory uses the system's default settings.
  • fancy —  The directory uses directory indexing with Apache® FancyIndexing directive. The directory will include additional information such as file size and the date of the file's last update.
inherit 

path

string

The parent directory's directory path.

The function returns this value in the parent hash.

A valid absolute directory path./home/example
children array of hashes

A list of subdirectories and their indexing information.

Note:

The function returns this hash for each subdirectory in a directory.

This array of hashes contains the state hash and path returns.

state

hash

The subdirectory's indexing information.

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

This hash contains the index_type return.

index_type

string

The directory's indexing type.

The function returns this value in the state hash.

  • standard — The directory uses directory indexing with standard formatting.
  • disabled — The directory doesn't use directory indexing.
  • inherit — The directory uses the system's default settings.
  • fancy —  The directory uses directory indexing with Apache® FancyIndexing directive. The directory will include additional information such as file size and the date of the file's last update.
inherit

path

string

The subdirectory's directory path.

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

A valid absolute directory path./home/example/example.com/cgi-bin