Skip to content

Instantly share code, notes, and snippets.

@PsPsam
PsPsam / removefolder.ps1
Last active May 31, 2017 10:58
Remove empty folders
function remove-emptyfolders-t1 {
Param
(
# Path to the folder to check for old files
[Parameter(Mandatory, HelpMessage = 'Will remove empty subfolders',
ValueFromPipelineByPropertyName,
Position = 0)]
[string]$path
)
Get-ChildItem -Path $path -Recurse -Force -Directory |