LineZip, Per zippare via cmd

« Older   Newer »
  Share  
CAT_IMG Posted on 22/3/2010, 15:07     +1   -1

So creare belle gui

Group:
Bannato
Posts:
555
Reputazione:
0

Status:


Ciao a tutti... ecco un programma in AutoIT che permette di zippare via file batch o exe dei file...

source:
SPOILER (click to view)
CODICE
#cs
#################################
## LineZip by RiKI             ##
## # # # # # # # # # # # # # # ##
## Based on Zip.au3 by Torels  ##
#################################
#ce

; Sintassi:        linezip.exe zip ":curdir:\cartella\" ":curdir:\zip.zip"
;                        linezip.exe unzip ":curdir:\zip.zip"

#include <Zip.au3>
msgbox(0, @ScriptLineNumber, "")

If $CMDLine[0] = 0 Then
       Exit
ElseIf $CMDLine[1] = "zip" AND $CMDLine[0] > 3 Then
       ConsoleWrite("Numero di parametri scorretto!")
       Exit
ElseIf $CMDLine[1] = "unzip" AND $CMDLine[0] > 2 Then
       ConsoleWrite("Numero di parametri scorretto!")
       Exit
EndIf

Switch $CMDLine[1]
Case "zip"
       $zip_origine = AddCurDir($CMDLine[2])
       $zip_destinazione = AddCurDir($CMDLine[3])
       $zip = _Zip_Create($zip_destinazione)
       If @error Then
               ConsoleWrite("Errore: impossibile creare il file Zip!")
               Exit
       EndIf
       _Zip_AddFolderContents($zip, $zip_origine)
       If @error = 4 Then
               ConsoleWrite("Cartella non trovata o non valida.")
               FileDelete($zip_destinazione)
               Exit
       ElseIf @error = 2 OR @error = 3 Then
               ConsoleWrite("Sul tuo computer non è installata la libreria ZIP!")
               FileDelete($zip_destinazione)
               Exit
       EndIf
       ConsoleWrite(@LF & "Compressione effettuata con successo!" & @LF)
       $list = _Zip_List($zip)
       ConsoleWrite(@LF & "File contenuti nell'archivio:")
       For $i = 1 to UBound($list) - 1    
               ConsoleWrite(@LF & "  > " & $list[$i])
       Next
       ConsoleWrite(@LF)
       Exit
Case "unzip"
       ; $unzip_origine = StringRegExpReplace($CMDLine[2], ":curdir:", @ScriptDir)
       ConsoleWrite("Prossimamente ;)")
       Exit
Case Else
       Exit
EndSwitch

Func AddCurDir($sInput)
       $curdircheck = StringInStr($sInput, ":curdir:")
       If $curdircheck = 1 Then
               $casuale = Random(73248, 432847298347, 1)
               $dir = @ScriptDir
               $res1 = StringRegExpReplace($dir, "\\", $casuale)
               $res2 = StringRegExpReplace($sInput, ":curdir:", $res1)
               $fres = StringRegExpReplace($res2, $casuale, "\\")
               Return $fres
       Else
               SetError(1, 0, 0)
       EndIf
EndFunc


Zip.au3 lo trovate qui.

Edited by nr5 - 22/3/2010, 15:09
 
Top
Kurt_Black_hat 2.0
CAT_IMG Posted on 22/3/2010, 15:08     +1   -1




La potenza.
 
Top
CAT_IMG Posted on 22/3/2010, 15:10     +1   -1

So creare belle gui

Group:
Bannato
Posts:
555
Reputazione:
0

Status:


-_-
 
Top
Lahace
CAT_IMG Posted on 22/3/2010, 15:15     +1   -1




carino dai xD
 
Top
CAT_IMG Posted on 22/3/2010, 21:09     +1   -1

So creare belle gui

Group:
Bannato
Posts:
555
Reputazione:
0

Status:


grazie :)
 
Top
Gianlu-thebest
CAT_IMG Posted on 22/3/2010, 21:54     +1   -1




ops... ho dimenticato di dire:
Bello!
 
Top
CAT_IMG Posted on 23/3/2010, 07:40     +1   -1

So creare belle gui

Group:
Bannato
Posts:
555
Reputazione:
0

Status:


:P grazie!
 
Top
6 replies since 22/3/2010, 15:07   78 views
  Share