1
<?xml version="1.0" encoding="utf-8"?>
2
<page xmlns="http://projectmallard.org/1.0/" type="topic" id="file-selection" xml:lang="oc">
4
<link type="guide" xref="index#dialogs"/>
5
<desc>Use the <cmd>--file-selection</cmd> option.</desc>
7
<title>File Selection Dialog</title>
9
Use the <cmd>--file-selection</cmd> option to create a file selection dialog. <app>Zenity</app> returns the selected files or directories to standard
10
output. The default mode of the file selection dialog is open.
13
The file selection dialog supports the following options:
19
<title><cmd>--filename</cmd>=<var>filename</var></title>
20
<p>Specifies the file or directory that is selected in the file selection dialog when the dialog is first shown.</p>
24
<title><cmd>--multiple</cmd></title>
25
<p>Allows the selection of multiple filenames in the file selection dialog.</p>
29
<title><cmd>--directory</cmd></title>
30
<p>Allows only selection of directories in the file selection dialog.</p>
34
<title><cmd>--save</cmd></title>
35
<p>Set the file selection dialog into save mode.</p>
39
<title><cmd>--separator</cmd>=<var>separator</var></title>
40
<p>Specifies the string that is used to divide the returned list of filenames.</p>
46
The following example script shows how to create a file selection dialog:
52
FILE=`zenity --file-selection --title="Select a File"`
56
echo "\"$FILE\" selected.";;
58
echo "No file selected.";;
60
echo "An unexpected error has occurred.";;
64
<figure id="zenity-fileselection-screenshot">
65
<title>File Selection Dialog Example</title>
66
<desc><app>Zenity</app> file selection dialog example</desc>
67
<media type="image" mime="image/png" src="figures/zenity-fileselection-screenshot.png"/>