I have folders like this.
- Main folder
- sub1
- sub6
- sub8
I want to compress these folders to sub1.zip
, sub6.zip
and sub8.zip
using VBScript.
I was using this VBScript and batch file:
'Get command-line arguments.
Set objArgs = WScript.Arguments
InputFolder = objArgs(0)
ZipFile = objArgs(1)
'Create empty ZIP file.
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
Set objShell = CreateObject("Shell.Application")
Set source = objShell.NameSpace(InputFolder).Items
objShell.NameSpace(ZipFile).CopyHere(source)
'Required!
wScript.Sleep 2000
For converting each folders using batch file like this:
set /p "xxx=enter your subfolder name"
cscript.exe zip.vbs "%xxx%" "%xxx%.zip"
How to compress each subfolder into a ZIP archive file without deleting the folder?
I am not a programmer. I don't know how to use for loop to input a text file. I don't have any external software like WinRAR or 7-Zip.