My vbs code below takes specified file and zipps it. I need to amend it such that:
1) it dynamically picks the file in the directory C:\files\ . I dont want to declare the file name in the code.
2) passwords protect it using the name of the file. so if the file was called file123.txt, than the password is "file123"
I have been struggling to make get this working especially since I'm not a vbs coder
code:
1) it dynamically picks the file in the directory C:\files\ . I dont want to declare the file name in the code.
2) passwords protect it using the name of the file. so if the file was called file123.txt, than the password is "file123"
I have been struggling to make get this working especially since I'm not a vbs coder
code:
Code:
Const FOF_CREATEPROGRESSDLG = &H0&
Const File1 = "C:\files\test.txt"
Const MyZip = "C:\files\test.zip"
CreateObject("Scripting.FileSystemObject") _
.CreateTextFile(MyZip, True) _
.Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
'-------------- zip ---------------------------
'get ready to add files to zip
With CreateObject("Shell.Application")
'add files
.NameSpace(MyZip).CopyHere File1, FOF_CREATEPROGRESSDLG
.NameSpace(MyZip).CopyHere File2
End With
wScript.Sleep 1000
wscript.echo "Done!"