< Back

Disable-CNtfsCompression

Sun Jan 12, 2020 9:15 pm

NAME Disable-CNtfsCompression



SYNOPSIS

Turns off NTFS compression on a file/directory.





SYNTAX

Disable-CNtfsCompression [-Path] <String[]> [-Recurse] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

The `Disable-CNtfsCompression` function uses `compact.exe` to disable compression on a file or directory. When

decompressing a directory, any compressed files/directories in that directory will remain compressed. To

decompress everything under a directory, use the `-Recurse` switch. This could take awhile.



Beginning in Carbon 2.9.0, if compression is already disabled, nothing happens. To always disable compression, use

the `-Force` switch.



Uses Windows' `compact.exe` command line utility to compress the file/directory. To see the output from

`compact.exe`, set the `Verbose` switch.





PARAMETERS

-Path <String[]>

The path where compression should be disabled.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Recurse [<SwitchParameter>]

Disables compression on all sub-directories.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Force [<SwitchParameter>]

Disable compression even it it's already disabled.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Disable-CNtfsCompression -Path C:\\Projects\\Carbon



Turns off NTFS compression and decompresses the `C:\\Projects\\Carbon` directory (if compression is enabled), but

not its sub-directories/files.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Disable-CNtfsCompression -Path C:\\Projects\\Carbon -Recurse



Turns off NTFS compression and decompresses the `C:\\Projects\\Carbon` directory (if compression is enabled) and all

its sub-directories/sub-files.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Disable-CNtfsCompression -Path C:\\Projects\\Carbon -Recurse -Force



Turns off NTFS compression and decompresses the `C:\\Projects\\Carbon` directory (even if compression is disabled)

and all its sub-directories/sub-files.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-ChildItem * | Where-Object { $_.PsIsContainer } | Disable-CNtfsCompression



Demonstrates that you can pipe the path to compress into `Disable-CNtfsCompression`.











RELATED LINKS

Enable-CNtfsCompression

Test-CNtfsCompression