Evotec

Project

PSPublishModule

PSPublishModule is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 43
Forks 13
Open issues 1
PowerShell Gallery downloads 13,876
Release v3.0.3
Language: C# Updated: 2026-04-14

API Reference

Cmdlet

Remove-ProjectFiles

Namespace PSPublishModule
Inputs
None
Outputs
System.Object

Removes specific files and folders from a project directory with safety features.

Remarks

Designed for build/CI cleanup scenarios where removing generated artifacts (bin/obj, packed outputs, temporary files) should be predictable and safe. Supports -WhatIf, retries and optional backups.

Examples

Authored help example

Preview cleanup of build artifacts

PS>


Remove-ProjectFiles -ProjectPath '.' -ProjectType Build -WhatIf
        

Shows what would be removed for the selected cleanup type.

Remove custom patterns with backups enabled

PS>


Remove-ProjectFiles -ProjectPath '.' -IncludePatterns 'bin','obj','*.nupkg' -CreateBackups -BackupDirectory 'C:\Backups\MyRepo'
        

Creates backups before deletion and stores them under the backup directory.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Remove-ProjectFiles [-BackupDirectory <String>] [-CreateBackups] [-DeleteMethod <RemoveItem|DotNetDelete|RecycleBin>] [-ExcludeDirectories <String[]>] [-ExcludePatterns <String[]>] [-Internal] [-MaxDepth <Int32>] [-PassThru] -ProjectPath <String> [-ProjectType <Build|Logs|Html|Temp|All>] [-Recurse] [-Retries <Int32>] [-ShowProgress] [<CommonParameters>]
#
Parameter set: ProjectType

Parameters

BackupDirectory String optionalposition: namedpipeline: False
Directory where backups should be stored (optional).
CreateBackups SwitchParameter optionalposition: namedpipeline: False
Create backup copies of items before deletion.
DeleteMethod ProjectDeleteMethod optionalposition: namedpipeline: Falsevalues: 3
Method to use for deletion.
Possible values: RemoveItem, DotNetDelete, RecycleBin
ExcludeDirectories String[] optionalposition: namedpipeline: False
Directory names to completely exclude from processing.
ExcludePatterns String[] optionalposition: namedpipeline: False
Patterns to exclude from deletion.
Internal SwitchParameter optionalposition: namedpipeline: False
Suppress console output and use verbose/warning streams instead.
MaxDepth Int32 optionalposition: namedpipeline: False
Maximum recursion depth. Default is unlimited (-1).
PassThru SwitchParameter optionalposition: namedpipeline: False
Return detailed results.
ProjectPath String requiredposition: namedpipeline: False
Path to the project directory to clean.
ProjectType ProjectCleanupType optionalposition: namedpipeline: Falsevalues: 5
Type of project cleanup to perform.
Possible values: Build, Logs, Html, Temp, All
Recurse SwitchParameter optionalposition: namedpipeline: False
Process subdirectories recursively. Defaults to true unless explicitly specified.
Retries Int32 optionalposition: namedpipeline: False
Number of retry attempts for each deletion.
ShowProgress SwitchParameter optionalposition: namedpipeline: False
Display progress information during cleanup.

Outputs

System.Object

Remove-ProjectFiles [-BackupDirectory <String>] [-CreateBackups] [-DeleteMethod <RemoveItem|DotNetDelete|RecycleBin>] [-ExcludeDirectories <String[]>] [-ExcludePatterns <String[]>] -IncludePatterns <String[]> [-Internal] [-MaxDepth <Int32>] [-PassThru] -ProjectPath <String> [-Recurse] [-Retries <Int32>] [-ShowProgress] [<CommonParameters>]
#
Parameter set: Custom

Parameters

BackupDirectory String optionalposition: namedpipeline: False
Directory where backups should be stored (optional).
CreateBackups SwitchParameter optionalposition: namedpipeline: False
Create backup copies of items before deletion.
DeleteMethod ProjectDeleteMethod optionalposition: namedpipeline: Falsevalues: 3
Method to use for deletion.
Possible values: RemoveItem, DotNetDelete, RecycleBin
ExcludeDirectories String[] optionalposition: namedpipeline: False
Directory names to completely exclude from processing.
ExcludePatterns String[] optionalposition: namedpipeline: False
Patterns to exclude from deletion.
IncludePatterns String[] requiredposition: namedpipeline: False
File/folder patterns to include for deletion when using the Custom parameter set.
Internal SwitchParameter optionalposition: namedpipeline: False
Suppress console output and use verbose/warning streams instead.
MaxDepth Int32 optionalposition: namedpipeline: False
Maximum recursion depth. Default is unlimited (-1).
PassThru SwitchParameter optionalposition: namedpipeline: False
Return detailed results.
ProjectPath String requiredposition: namedpipeline: False
Path to the project directory to clean.
Recurse SwitchParameter optionalposition: namedpipeline: False
Process subdirectories recursively. Defaults to true unless explicitly specified.
Retries Int32 optionalposition: namedpipeline: False
Number of retry attempts for each deletion.
ShowProgress SwitchParameter optionalposition: namedpipeline: False
Display progress information during cleanup.

Outputs

System.Object