'================================ VBS ================================
' Упаковать подкаталоги в одноимённые zip-архивы в выбранных каталогах
' Параметры: %WL "<имя подкаталога>"
'=====================================================================
Option Explicit : Dim A, Mask, FSO, ShA, List, Str, Arch
Set A = WSH.Arguments : If A.Count Then Mask = A(1) Else WSH.Quit
Set FSO = CreateObject("Scripting.FileSystemObject")
Set ShA = GetObject("new:{9BA05972-F6A8-11CF-A442-00A0C90A8F39}").Item.document.Application
Set List = FSO.OpenTextFile(A(0),,,-1)
Do: Str = List.ReadLine
If Right(Str, 1) = "\" Then
If FSO.FolderExists(Str & Mask) Then
Arch = Str & Mask & ".zip"
With FSO.CreateTextFile(Arch, 1) .Write "PK" & String(17, Chr(0)) :.Close: End With
ShA.NameSpace(Arch).CopyHere Str & Mask, 13332
End If
End If
Loop Until List.AtEndOfStream : List.Close
Set List = Nothing : Set FSO = Nothing : Set ShA = Nothing |