Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Пакетное архивирование 
Author Message
Batya



PostPosted: Fri Apr 28, 2006 11:01    Post subject: Reply with quote

Code:
'==========================================================================
' Создание отдельных архивов для каждой вложенной папки в выделенных папках

' В параметрах вызова из TC должно быть прописано:
' %L
'==========================================================================

Dim FSO, WS, FoldList, Fold, Fold1, WinRar, Command, Command1, Command2, ArchKeys, FullArchName
Set FSO      = CreateObject("Scripting.FileSystemObject")
Set WS       = CreateObject("WScript.Shell")
Set FoldList = FSO.OpenTextFile(WScript.Arguments(0), 1)

WinRar   = "D:\Program Files\WinRAR\WinRAR.exe"  ' Путь к WinRAR.exe
Command1 = " A"                                  ' "Добавить файлы в архив"
Command2 = " U"                                  ' "Обновить файлы в архиве"
ArchKeys = " -r -ep1 -ibck"                      ' Ключи:
                                                 '   "Рекурсивно с вложенными папками"
                                                 '   "Исключить из пути базовую папку"
                                                 '   "Запустить WinRAR как фоновый процесс в системном лотке"
Do While Not FoldList.AtEndOfStream
  FoldPath = FoldList.ReadLine
  Set Fold = FSO.GetFolder(FoldPath)
  For Each Fold1 in Fold.SubFolders
    FullArchName = FoldPath & Fold1.Name & ".rar"
    If Not FSO.FileExists(FullArchName) Then
      Command = Command1
    Else
      Command = Command2
    End If
    WS.run """" & WinRar & """" & Command & ArchKeys & " """ & FullArchName & """ """ & Fold1.Path & "\""", , True
  Next
Loop

Set FSO      = Nothing
Set WS       = Nothing
Set Fold     = Nothing
Set Fold1    = Nothing
Set FoldList = Nothing
WScript.Quit

Сохрани код в файл *.vbs. Повесь этот файл на кнопку. В параметрах кнопки напиши %L. Скрипт архивирует WinRar-ом, поэтому в скрипте поправь путь к WinRar на свой.
Скрипт работает по отмеченным "большим" папкам (всё ж таки этот форум про TC, поэтому в TC надо что-то делать Wink ).
Если что-то работает не совсем так, как ты хочешь, пиши - поправлю скрипт.
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group