Другие языки программирования и технологии

плиииииииз помогите пожалуйста, срочно. . Написать скрипт, выполняющий архивацию файлов и каталогов..

Пример скрипта на vbs, разберетесь или нет, не знаю:
Set FileSytemObject = CreateObject("Scripting.FileSystemObject")
'/// Получаем путь до каталога, в котором находимся
ParentFolderName = FileSytemObject.GetParentFolderName(Wscript.ScriptFullName)
'/// Строим путь для создания тестового файла
SourceFilePath = FileSytemObject.BuildPath(ParentFolderName, "Текстовый документ. txt")
'/// Создаём и заполняем файл содержимым
FileSytemObject.OpenTextFile(SourceFilePath, 2, True).write "Содержимое файла"
'/// Строим путь для создания архива
DestFilePath = FileSytemObject.BuildPath(ParentFolderName, "1.zip")
'/// Создаём класс создания ZIP файла
Set Zip = New ZipClass
'/// Создаём новый архив
Zip.CreateArchive DestFilePath
'/// Добавляем файл в архив
Zip.CopyFileToArchive SourceFilePath
'/// Закрываем архив
Zip.CloseArchive

MsgBox "Архив создан", vbInformation, "ZipClass"

Class ZipClass
Private Shell
Private FileSystemObject
Private ArchiveFolder
Private ItemsCount

Private Sub Class_Initialize()
Set Shell = CreateObject("Shell.Application")
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
End Sub

Function CreateArchive(ZipArchivePath)
If UCase(FileSystemObject.GetExtensionName(ZipArchivePath)) <> "ZIP" Then
Exit Function
End If

Dim ZipFileHeader
ZipFileHeader = "PK" & Chr(5) & Chr(6) & String(18, 0)
FileSystemObject.OpenTextFile(ZipArchivePath, 2, True).Write ZipFileHeader
Set ArchiveFolder = Shell.NameSpace(ZipArchivePath)
If Not (ArchiveFolder is Nothing) Then CreateArchive = True
End Function

Function CopyFileToArchive(FilePath)
If (ArchiveFolder Is Nothing) Then Exit Function
ArchiveFolder.CopyHere FilePath
ItemsCount = ItemsCount + 1
End Function

Function CopyFolderToArchive(FolderPath)
If (ArchiveFolder Is Nothing) Then Exit Function
ArchiveFolder.CopyHere FolderPath
ItemsCount = ItemsCount + 1
End Function

Function CloseArchive
If (ArchiveFolder is Nothing) Then Exit Function
Set WsriptShell = CreateObject("Wscript.Shell")
If IsObject(Wscript) Then
Do
Wscript.Sleep 100
Loop Until ArchiveFolder.Items.Count => ItemsCount
Else
ServerSleep
End if
ItemsCount = 0
End Function

Private Function ServerSleep
Set WsriptShell = CreateObject("Wscript.Shell")
Do
WsriptShell.Popup "", 1, ""
Loop Until ArchiveFolder.Items.Count => ItemsCount
End Function

Function MoveFileToArchive(FilePath)
If (ArchiveFolder is Nothing) Then Exit Function
ArchiveFolder.MoveHere FilePath
End Function
End Class
Алексей Сосипаторов
Алексей Сосипаторов
7 013
Лучший ответ
Какой язык скрипта????
Глеб Бражник
Глеб Бражник
6 654