0

I have a VBScript which recursively executes and unzips multiple zip files in a folder into another directory. I would like to add another have an option to replace existing files incase of duplicates.

Below is the VBS

Set objArgs = WScript.Arguments

ZipFile = objArgs(0)

ExtractTo = objArgs(1)

'If the extraction location does not exist create it.
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(ExtractTo) Then
   fso.CreateFolder(ExtractTo)
End If

'Extract the contants of the zip file.
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Dim objShell
Set objShell = Wscript.CreateObject("WScript.Shell")


' Using Set is mandatory
Set objShell = Nothing

Below is my batch script which calls this vbs recursively.

for %%A in ("%2\*.zip") do "%1" "%%A" "%3"
dunantsm
  • 47
  • 7

0 Answers0