Wednesday, July 19, 2023

Compress and Expand archive files.


 - We can compress files into archive file using  ps script.

```sh

# Example
	$compress = @{
  				Path = "C:\Reference\Readme-draft.md", "C:\Users\Downloads\*.pdf"
  				CompressionLevel = "Fastest"
  				DestinationPath = "C:\Archives\Draft-docs.zip"
				}
	
    Compress-Archive @compress

```
 
 - We can expand archive file using  ps script.

```sh
      
#Example-1      
      Expand-Archive -LiteralPath 'C:\Downloads\Azure.Functions.Cli.min.win-x64.4.0.4865.zip'  `
      				 -DestinationPath C:\Users\rkolla\Downloads\Azure.Functions.Cli.min.win-x64.4.0.4865
      
#Example-2            
      Expand-Archive -LiteralPath 'C:\Downloads\node-v18.17.0-win-x64.zip' `
                     -DestinationPath C:\Users\rkolla\Downloads\node-v18.17.0-win-x64
```

No comments:

Post a Comment