listFiles()

The listFiles() function returns an array of file names in the current directory that the application has opened using file commands.

Syntax

listFiles()

Parameters

None

Return Value

An array of strings, where each string is the name of a file that has been opened by the application.

Description

The listFiles() function provides a way to discover what files are available to your application. It returns a list of files that:

  1. Are in the current working directory

  2. Have been previously opened by the application

  3. The application has permission to access

This is useful for applications that need to work with multiple files or need to display a list of available files to the user.

Examples

Basic Usage

Checking if a File Exists

Processing Multiple Files

Creating a File Selector

Notes

  • The function only lists files that the application has previously opened

  • It does not list all files in the directory (for security reasons)

  • The returned list may be empty if no files have been opened yet

  • File permissions are still enforced when trying to open files from the list

  • The function returns only file names, not full paths

  • To get more information about files, you'll need to open them individuall

Last updated

Was this helpful?