Logo

Documentation home for Transend tools

Remove-EmptyFolders

SYNOPSIS

Removes empty folders from the supplied path.

SYNTAX

Remove-EmptyFolders [-Path] <String> [-Recurse] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The Remove-EmptyFolders cmdlet removes all empty folders contained in the supplied path. By default, only empty folders directly contained in the supplied path will be removed, but you can optionally remove empty subfolders as well.

EXAMPLES

Example 1

Remove-EmptyFolders -Path 'C:\Temp'

Removes any empty folder under C:\Temp. For example, if C:\Temp\Empty is an empty folder, it will be removed. However, if C:\Temp\Sub\Empty is empty, it will not be removed.

Example 2

Remove-EmptyFolders -Path 'C:\Temp' -Recurse

Removes any empty folders under C:\Temp, including subfolders. For example, if C:\Temp\Empty is an empty folder, it will be removed. If C:\Temp\Sub\Empty is empty, it will also be removed.

PARAMETERS

-Path

The path of a folder in which empty subfolders will be removed.

Type: String
Parameter Sets: (All)
Aliases:

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

-Recurse

Indicates that the Remove-EmptyFolders cmdlet should traverse subfolders to find all empty folders to remove.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

None

OUTPUTS

System.Void

NOTES

TMCTools configuration options