Hi all,
well i have suffered for many days to get this code for my case but unfortunately i failed:(
i want to go on target path folder which contains about 500 zipped files then open each on of them and delete one folder and another single file
as shown on below link
http://imgur.com/a/k9c2E
open Zip filder —> go on (xl) folder —> delete (queryTables) and (connections.xml)
any help or hint please
Thanks in advance
Do you have code that works up to a point?
If you are trying to work with zip files powershell 5 does have some commands to help. see https://blogs.technet.microsoft.com/heyscriptingguy/2015/08/14/working-with-compressed-files-in-powershell-5/
This will delete the folder and file from your zips.
$zip = Get-ChildItem \\path\to\zips -Filter *.zip
add-type -AssemblyName 'System.IO.Compression.filesystem'
# Change zip file
foreach ($z in $zip){
Write-Verbose "Updating $($z.name)" -Verbose
$tempz = [io.compression.zipfile]::Open($z.FullName,'Update')
$entry = $tempz.Entries | Where-Object {
$_.fullname -match 'queryTables|connections.xml'}
foreach ($e in $entry){$e.Delete()}
$tempz.Dispose()
}
Hello,
well at the first thanks for your reply and code
but when i used it i found that error msg below
any idea why??
and i already have “System.IO.Compression.FileSystem.dll” on my “.NETFramework\v4.5” folder
Thanks
Run
$PSVersionTable
Check PSVersion and CLRVersion (.NET Version)
What versions of PowerShell and .NET are installed? I tested it with PS:3.0 / CLR:4.0.30319.42000.
Update .NET and at least to PS 3.0
oh works perfect now, really i don’t find enough words to thank you
one more request please and anyway don’t push your self to answer if you are busy
i’m looking now to add (.zip) to all files at target path folder to be zipped manually and individually
then i want to reverse this process with another code, delete (.zip) to all individually too
for ex,
Test.xls —> Test.xls.zip —> Test.xls
and to be applied on many files at target path folder
can it be
Thanks in advance
cheers
well i think i got it finally

Dir *.xls | rename-item -newname { [io.path]::ChangeExtension($_.name, “xls.zip”) }
Thanks a lot for your care