In the previous post, we have discussed how to zip the folder/files, so here we going to discuss how to unzip files and folders archives. The process is even easier than compressing them; all you need is the source file and a destination for the data ready to unzip.
Syntax : Expand-Archive -LiteralPath <PathToZipFile> -DestinationPath <PathToDestination>
In the above command, replacing <PathToZipFile> and <PathToDestination> with the path to the files you want to Un-compress and the name and folder you want it to go to, respectively
Example :
Expand-Archive -LiteralPath C:\dotnet-helpers\Source\ExtractMe.zip -DestinationPath C:\dotnet-helpers\Destination\
The destination folder specified to extract the files into will populate with the contents of the archive. If the folder didnโt exist before unzipping, PowerShell will create the folder and place the contents into it before unzipping.
If the destination folder already exists in the destination, PowerShell will return an error when it tries to unzip the files. However, you can use -Force PowerShell to overwrite the data with the new ones using the -Force parameter.
Leave A Comment