# File Selection Dialog

&#x20;Use the file-selection option to create a file selection dialog. Zenity returns the selected files or directories to standard output. The default mode of the file selection dialog is open.

&#x20;The file selection dialog supports the following options:&#x20;

| option    | description                                                                                                    |
| --------- | -------------------------------------------------------------------------------------------------------------- |
| filename  | Specifies the file or directory that is selected in the file selection dialog when the dialog is first shown.- |
| multiple  | Allows the selection of multiple filenames in the file selection dialog.                                       |
| directory |                                                                                                                |

-multiple

\--directory

Allows only selection of directories in the file selection dialog.--save

Set the file selection dialog into save mode. --separator=separator

Specifies the string that is used to divide the returned list of filenames.

&#x20;The following example script shows how to create a file selection dialog:

```
        #!/bin/sh

        FILE=`zenity --file-selection --title="Select a File"`

        case $? in
                 0)
                        echo "\"$FILE\" selected.";;
                 1)
                        echo "No file selected.";;
                -1)
                        echo "No file selected.";;
        esac
```

Figure 2 File Selection Dialog Example


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pyzenity.gitbook.io/docs/dialogs/file-selection-dialog.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
