Jump to content

miudinho

Members
  • Posts

    1
  • Joined

  • Last visited

miudinho's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. hello friend, your function works well, but when the file already exists it asks to confirm the extraction, there is a way to extract it without having to confirm it, and it replaces the existing one automatically #include <Constants.au3> Opt("MustDeclareVars", 1) Const $sZipFile = @ScriptDir & "\Test.zip" Const $sDestFolder = @ScriptDir & "\Temp" UnZip($sZipFile, $sDestFolder) If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error unzipping file : " & @error) Func UnZip($sZipFile, $sDestFolder)   If Not FileExists($sZipFile) Then Return SetError (1) ; source file does not exists   If Not FileExists($sDestFolder) Then     If Not DirCreate($sDestFolder) Then Return SetError (2) ; unable to create destination   Else     If Not StringInStr(FileGetAttrib($sDestFolder), "D") Then Return SetError (3) ; destination not folder   EndIf   Local $oShell = ObjCreate("shell.application")   Local $oZip = $oShell.NameSpace($sZipFile)   Local $iZipFileCount = $oZip.items.Count   If Not $iZipFileCount Then Return SetError (4) ; zip file empty   For $oFile In $oZip.items     $oShell.NameSpace($sDestFolder).copyhere($ofile)   Next EndFunc   ;==>UnZip
×
×
  • Create New...