ModuleForge

Get-MFFolderItems

SYNOPSIS

Retrieves a filtered list of files from a specified folder, processing ‘.mfignore’ and ‘.mforder’ rules.

SYNTAX

Default (Default)

Get-MFFolderItems -Path <String> [-PSScriptsOnly] [-ProgressAction <ActionPreference>] [<CommonParameters>]

Copy

Get-MFFolderItems -Path <String> [-PSScriptsOnly] [-Destination <String>] [-Copy]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The ‘Get-MFFolderItems’ function scans a folder and applies filtering rules to return a curated list of files. It offers additional filtering logic, such as:

The function ensures all returned paths are fully qualified. This function is primarily used to assist the get-mfFolderItemDetails as well as build-mfProject. The -copy switch is added to cleanly copy resources and binaries with build-mfProject

EXAMPLES

EXAMPLE 1

Get-MFFolderItems -Path '.\source\functions' -PSScriptsOnly

DESCRIPTION

Scans `.\source\functions`, retrieves only `.ps1` files, and excludes files matching `.mfignore` rules.

EXAMPLE 2

Get-MFFolderItems -Path '.\source\functions' -Destination '.\build\functions' -Copy

DESCRIPTION

Scans `.\source\functions`, retrieves filtered files, and copies them to `.\build\functions`.

PARAMETERS

-Path

Path to get items from

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-PSScriptsOnly

Flag to copy scripts only

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Destination

Flag to copy scripts only

Type: String
Parameter Sets: Copy
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Copy

Flag to actually copy files and not just output

Type: SwitchParameter
Parameter Sets: Copy
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

[String] - Accepts a folder path via parameter or pipeline (ValueFromPipelineByPropertyName).

OUTPUTS

[Object[]] - Returns an array of objects containing:

- Name ([String]) - Name of the file.

- Path ([String]) - Full file path.

- RelativePath ([String]) - Path relative to the source folder.

- Folder ([String]) - Name of the source folder.

- (Optional) newPath ([String]) - Destination path if copying.

- (Optional) newFolder ([String]) - Destination folder name if copying.

OUTPUTS

NOTES

Author: Adrian Andersson