🖋️
Docs
  • Zenity
  • Introduction
  • dialogs
    • Calendar Dialog
    • File Selection Dialog
    • List Dialog
    • Message Dialogs
    • Notification Icon
    • Text Entry Dialog
    • Progress Dialog
    • Text Information Dialog
Powered by GitBook
On this page

Was this helpful?

  1. dialogs

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:

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.

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

PreviousCalendar DialogNextList Dialog

Last updated 4 years ago

Was this helpful?