Skip to content

Directory Listing

Backendless.Files.listing(path, pattern, recursively, pagesize, offset)
 .then( function( fileInfoArray ) {
 .catch( function( error ) {


Argument                Description
path path of a directory to get a listing of. The path must start with the root directory identified by forward slash, for example: "/web".
pattern an optional parameter. A pattern which the returned files and directories must match. The pattern can include wildcard characters. Asterisk (*) matches a substring of any length. Question mark (?) matches only one character in the file/directory name.
recursive an optional parameter. A boolean value of true or false. If present and is true, requests that the listing must be retrieved recursively for all directories contained within .
pagesize an optional parameter. If present, identifies how many items should be returned in the response.
offset an optional parameter. If present, indicates the index of item in the response from which to get the <pagesize> items.

Return value

A collection of files and directories matching the specified pattern. The returned collection may not include all files and directories as the size of the number of returned entries is limited for paging purposes. To get the next set of file/directory entries, an additional request must be made with a different offset value. The total count of all files/directories in the listing use the Get File Count API.

Each element in the collection contains the following properties:

  • name - name of the file or directory without any path information
  • public URL - absolute URL of the file or directory
  • URL - relative URL of the file or directory starting from the root of the file storage
  • created on - a timestamp indicating when the file or directory were created


The example below describes how to get a listing of all HTML files from the /web directory and all subdirectories.

Backendless.Files.listing( "/web", "*.html", true )
 .then( function( fileInfoArray ) {
 .catch( function( error ) {


The server may return the following errors:

Error Code
Error message
File or directory cannot be found.
Occurs when the source file/directory cannot be found.
Path contains prohibited symbols: {path name}

The specified resource was not found
Occurs when the API requests to rename a non-existent file or a directory.
Specified resource must be a directory
Occurs when the path to get a listing for is not a directory