Hi all. I’m very new to powershell and i need your help with something.
I am looking for a way to check the contents of a list of zip files and if a specific file exists to replace it with a newer version.
Any idea how i can go about tackling this?
This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.
We actually expect you to make an own attempt at the first place to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.
I have managed to list the filenames of the zip files. But if for example the file i am looking for is 1.txt and is listed in 2 zip files, how can i replace it with the newer version i have?
Actually for simplicity let’s assume that the file i have is always newer and if it’s found inside a zip needs to be replaced. This is the part that i am not sure how to check. I can list the files inside the zip but how to check if that specific file is there AND replace it?
If the intent is to update any files in the archive you don’t even need to check. The Compress-Archive cmdlet has an -Update switch. It will check for newer files and update them for you.