Skip to content

pyui.select_folder

Daniel Flassig edited this page Jul 23, 2026 · 3 revisions

Displays the system folder-selection dialog and returns a path handle to the folder the user picks.

pyui.select_folder(access, title, options)

Parameters

Parameter Type Description
access string The access to request for the selected folder. One of "read" (read only) or "full" (create, modify and delete files).
title string (optional) The text shown in the title bar of the dialog.
options table (optional) Additional options, see below.

Options

Option Type Description
scope string How much of the folder is made accessible. One of "folder" (the folder and its direct files, the default) or "recursive" (the folder and its complete sub-tree).
start_at path handle A path handle that refers to a folder. It is used to pre-select a starting folder in the dialog.

Return value

Type Description
path handle A path handle to the selected folder, carrying the requested access level. Returns nil if the user cancels the dialog.

Remarks:

When access is "full", the user is asked to explicitly confirm write access to the chosen folder. If the confirmation is declined, the function returns nil as though the dialog had been cancelled.

The resulting handle carries the access level that matches scope: "folder" yields a directory handle, "recursive" yields a recursive handle.

Example:

local folder = pyui.select_folder("full", "Choose an export folder", {scope = "recursive"})
if folder then
	local target = folder:append_path("report.txt")
	pyio.write_lines(target, {"# Export report", "Parts exported: 3"})
else
	pyui.alert("No folder was selected.")
end

Version Support:

Minimum PYTHA Version: V26

See also:

pyui, Path Handles, pyui.select_open_file, pyui.select_save_file, pyio.write_lines, pyio.append_path, pyio.list_folder

Clone this wiki locally