How to delete files from zip using VBScript

Im very new to VBScript (this is my first time ever using it). So far, I have copied and changed my path to receive, as far as I know.

I have an APK file that is too large for my needs. So I do it manually, changing it to zip, and then deleting a couple of images from it, and then renaming it back to APK. I am trying to automate this using VBScript. Still i

Set oShell = CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") sFolder = WORKSPACE & "\temp\" & app & "\build\" & PLATFORMSUBFOLDER & "\dist\" & app & "\bin" oShell.CurrentDirectory = sFolder 'Make the Apk a Zip. fso.MoveFile apkfile, zipApk 

It all works, and I see in Windows Explorer that the APK changes to zip the way I want it. So I wonder if there are any quick ways to just log in and delete a couple of files without extracting all this?

If not, is there an easy way to extract files and analyze them at the same time?

Ive looked here. Extracting files from a ZIP file using VBScript but it doesn't seem to work. I keep getting the error "Required object:" objShell.Names (...) "" Any hints on why this is happening?

0
source share
1 answer

Use the MoveHere method to move an element from a zip file:

 zipfile = "C:\path\to\your.zip" fname = "some.file" dst = "C:\some\folder" Set app = CreateObject("Shell.Application") For Each f In app.NameSpace(zipfile).Items If f.Name = fname Then app.Namespace(dst).MoveHere(f) End If Next 

Then delete the files from the dst folder:

 Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFile fso.BuildPath(dst, fname), True 
+1
source

Source: https://habr.com/ru/post/980937/


All Articles