Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to display only the overwritten files while unzipping a .zip file?

I am successfully able to extract contents of a file using:

Expand-Archive -Force -LiteralPath c:\folder\my_file.zip -DestinationPath c:\dest_folder

However, it is not displaying the files which are overwritten.

How to display only the files which are overwritten?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you really want to replace the existing files but also know which ones where replaced, an alternative would be to redirect the verbose stream to the success stream and filter by those lines containing "Remove File". Expand-Archive when using -Verbose, will output the following when replacing (removing first and then creating) a file:

Performing the operation "Remove File" on target …..

In that sense, you can do the following:

Expand-Archive -LiteralPath .\my_file.zip -DestinationPath .\Destination\ -Force -Verbose 4>&1 |
Select-String 'Remove File'
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading