PromptPlus

PromptPlus # PromptPlus ## **MultiFile — Operations** [![NuGet](https://img.shields.io/badge/NuGet-PromptPlus-blue)](https://www.nuget.org/packages/PromptPlus) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![.NET](https://img.shields.io/badge/.NET-8%20%7C%209%20%7C%2010-512BD4)](https://dotnet.microsoft.com/)

← Back to Home • Next: MultiFile — Styles →


How the MultiFile control behaves while it is running: keyboard, tree navigation, checking, cascade and recursive marking, the count range, validation, history, and the values it returns.


Anatomy of the control

Check files or folders: Program.cs  1.2 KB ← prompt + live answer (path + size, follows the cursor)
Space to check, Enter to confirm         ← description (optional)
C:\Projects                              ← root folder
+- ▼ [x] src                             ← expanded, checked folder
│    › [x] Program.cs      1.2 KB        ← focused, checked file + size
│      [ ] Startup.cs      3.4 KB        ← unchecked file
+- ▶ [ ] docs                            ← collapsed folder
+- [x] README.md           0.8 KB
Checked: 3                               ← tagged info (count)
Page 1/2                                 ← pagination
Space: check  Enter: confirm  Esc: cancel ← tooltip

The live answer shows the size next to the path for a focused file (omitted for folders, and omitted entirely when HideSize is set), reachable via Home/End/←/→ scrolling if the path is too long to fit. The final answer after Enter shows the checked-items summary (paths only, no size).

Every region can be recolored — see Styles.


Tree navigation

MultiFile is a lazy tree browser: a folder’s children are read only when you expand it, and released when you collapse it. Checked entries are tracked by their full path, so a selection survives collapsing and re-expanding its branch.

Key Action
↑ / ↓ Move focus up / down
+ Expand the focused folder (plain → does not expand)
- Collapse the focused folder (plain ← does not collapse)
Tab On a folder: expand it (if needed) and move to its first child. On a file: move to the next item
Shift+Tab On a folder’s first child: collapse the parent and move to it. Otherwise: move to the previous item
Space Check / uncheck (recursive on folders by default — see below)
Ctrl+Space Recursive folder mark, when RecursiveMarkWithCtrlSpace is on
F2 Toggle all (check / uncheck everything currently loaded)
F3 Filter the list to show only checked items; press again to restore the full list
Page Up / Page Down Jump one page
Ctrl+Home / Ctrl+End First / last visible item (plain Home/End instead scroll the long-path answer text — see the anatomy note above)
Enter Confirm the checked entries (subject to the range)
Esc Abort → IsAborted == true
Shift+F3 Toggle the summary between full path and short name
F1 Cycle tooltip content
Ctrl+F1 Show / hide the tooltip

⚠️ There is no F4 wildcard-select feature — HotKeySelectWildcard/F4 was dead config that has since been removed. Use Space/Ctrl+Space (above) for recursive folder marking instead.


Checking, cascade & recursive marking

How Space behaves on a folder depends on two settings:

CascadeCheck RecursiveMarkWithCtrlSpace Space on a folder Ctrl+Space on a folder
true (default) false (default) Recursively checks the folder and everything under it —
true true Toggles only the folder itself Recursively checks the folder and everything under it
false — Toggles only the folder itself —

On files, Space always toggles just that file.


What can be checked


The count range

Range(min, max?) enforces how many items must be checked:


Validation with a predicate

PredicateChecked / PredicateCheckedAsync decides whether an item may be checked:


Full-path display

The summary shows either each entry’s short name or its full path. ShowFullPath sets the initial choice; the user can flip it with Shift+F3. This affects only the display — each FileItem.FullPath always carries the complete path.


Initial values & history


The FileItem results

Run() returns ResultPrompt<FileItem[]>. Each FileItem is a sealed class (not System.IO.FileInfo — there is no FullName):

Member Type Meaning
FullPath string Full path on disk (ToString() returns this)
Name string Display name of the entry
IsDirectory bool true for folders
Length long Size in bytes; 0 for directories
LastWriteTime DateTime Last write timestamp
var result = PromptPlus.Controls.MultiFile("Check").Root(root).Run();
if (!result.IsAborted)
{
    foreach (var f in result.Content)
        PromptPlus.Console.WriteLine($"{f.FullPath} (dir: {f.IsDirectory}, size: {f.Length})");
}

Options that change behavior

Set per instance via Options(...), or globally on PromptPlus.Config:

Option Effect on MultiFile
EnabledAbortKey(false) Removes Esc — the user must confirm
HideAfterFinish(true) Erases the tree after confirm — the whole control is erased, not just the interactive part
ShowTooltip(false) Hides the keyboard hint line
Prompt(...) / Description(...) Overrides the prompt / description text

PageSize can be set per control (PageSize) or globally (PromptPlus.Config.PageSize).


Edge cases & gotchas


See also