File Selection Dialog

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.

The file selection dialog supports the following options:


Specifies the file or directory that is selected in the file selection dialog when the dialog is first shown.


Allows the selection of multiple filenames in the file selection dialog.


Allows only selection of directories in the file selection dialog.


Set the file selection dialog into save mode.


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

The following example script shows how to create a file selection dialog:


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

case $? in
                echo "\"$FILE\" selected.";;
                echo "No file selected.";;
                echo "An unexpected error has occurred.";;

File Selection Dialog Example

Zenity file selection dialog example