Dela via


ContainerDirectory.GetFileSystemItemsFromPath Method

Definition

Enumerates files from a specified directory and converts them to ContainerFile objects.

public static System.Collections.Generic.IEnumerable<Aspire.Hosting.ApplicationModel.ContainerFileSystemItem> GetFileSystemItemsFromPath(string path, string searchPattern = "*", System.IO.SearchOption searchOptions = System.IO.SearchOption.TopDirectoryOnly, Action<Aspire.Hosting.ApplicationModel.ContainerFileSystemItem>? updateItem = default);
static member GetFileSystemItemsFromPath : string * string * System.IO.SearchOption * Action<Aspire.Hosting.ApplicationModel.ContainerFileSystemItem> -> seq<Aspire.Hosting.ApplicationModel.ContainerFileSystemItem>
Public Shared Function GetFileSystemItemsFromPath (path As String, Optional searchPattern As String = "*", Optional searchOptions As SearchOption = System.IO.SearchOption.TopDirectoryOnly, Optional updateItem As Action(Of ContainerFileSystemItem) = Nothing) As IEnumerable(Of ContainerFileSystemItem)

Parameters

path
String

The directory path to enumerate files from.

searchPattern
String

The search pattern to control the items matched. Defaults to *.

searchOptions
SearchOption

The search options to control the items matched. Defaults to SearchOption.TopDirectoryOnly.

updateItem
Action<ContainerFileSystemItem>

An optional function to update each ContainerFileSystemItem before returning it. This can be used to set additional properties like Owner, Group, or Mode.

Returns

An enumerable collection of ContainerFileSystemItem objects.

Exceptions

Thrown when the specified path does not exist.

Applies to