Sign in to follow this  
Followers 0
Bert

unzip a file

16 posts in this topic

#1 ·  Posted (edited)

I've looked up using the sevenzip.au3 and also tried to use pkzip. No matter how I try to do this, I can not get stuff to unzip. :whistle:

Could someone show me a example of code that will unzip a file? I tried this

#include <SevenZip.au3>
_SevenZipExtract("C:\test\New Folder.zip", "c:\test\", "*.*")oÝ÷ Økº{ºÙ趧+.8©¥çH¶¸vë"ÊdÚÛazƦzØbZ¦§±«­¢+ÙIÕ¹]¥Ð¡
=5MAµÀìÅÕ½Ðì½èÀäÈíÁ­Õ¹é¥À¹áµµèÀäÈíÑÍÐÀäÈíÑÍйé¥ÀÅÕ½Ðì¤

If someone could correct my example so it would work, that would be great. This is hurting my brain.

file location: C:\test\test.zip

output location: C:\test\new folder

Edited by vollyman

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi!

i think here you can find a unzip.exe! its great and compact!

http://www.mame.net/downmain.html (in bottom of the page)

so long spider

Edited by GtaSpider

www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

I've looked up using the sevenzip.au3 and also tried to use pkzip. No matter how I try to do this, I can not get stuff to unzip. :whistle:

what's the content of sevenzip.au3?

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

I've looked up using the sevenzip.au3 and also tried to use pkzip. No matter how I try to do this, I can not get stuff to unzip.

I worked with the command line version of 7Zip '7za.exe' without 'sevenzip.au3' and without problems.

7-Zip (A) 4.42  Copyright (c) 1999-2006 Igor Pavlov  2006-05-14

Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a: Add files to archive
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths
<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -t{Type}: Set type of archive
  -v{Size}[b|k|m|g]: Create volumes
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries

Share this post


Link to post
Share on other sites

what's the content of sevenzip.au3?

Cheers

Kurt

@/dev/null

'SevenZip.au3' you can find here. It uses the '7-zip32.dll'.

Share this post


Link to post
Share on other sites

; extracts all files from archive test.zip to the current directory
RunWait('U:\test\7za.exe e test.zip','',@SW_HIDE)

; extracts all *.jpg files from archive test.zip to c:\image folder
RunWait('U:\test\7za.exe e test.zip -oc:\image *.jpg -r','',@SW_HIDE)

; the same with full paths of files
RunWait('U:\test\7za.exe x test.zip','',@SW_HIDE)
RunWait('U:\test\7za.exe x test.zip -oc:\image *.jpg -r','',@SW_HIDE)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I've looked up using the sevenzip.au3 and also tried to use pkzip. No matter how I try to do this, I can not get stuff to unzip. :whistle:

Could someone show me a example of code that will unzip a file? I tried this

#include <SevenZip.au3>
_SevenZipExtract("C:\test\New Folder.zip", "c:\test\", "*.*")oÝ÷ Økº{ºÙ趧+.8©¥çH¶¸vë"ÊdÚÛazƦzØbZ¦§±«­¢+ÙIÕ¹]¥Ð¡
=5MAµÀìÅÕ½Ðì½èÀäÈíÁ­Õ¹é¥À¹áµµèÀäÈíÑÍÐÀäÈíÑÍйé¥ÀÅÕ½Ðì¤
Your test with 7ZIP and pkunzip is not the same! First you try to unzip the file "New Folder.zip" and then "test.zip". I guess there is no file "New Folder.zip". Check it first with FileExists(), then call _SevenZipExtract with the right parameters:

; Parameter(s):  $sArchive  - The Archive to use
;                  $sOutDir - Where to extract the files
;                  $sFilter - Files to extract from the Archive (e.g. *.exe)
;                  $sCMDLine   - Optional Options
;                   $hWnd      - The Window
; Requirement(s):   None
; Return Value(s):  On Success - Return 1
;                  On Failure - Return 0; @Error = 1
; Author(s):        JAK-Software.org
; Note(s):          Needs 7-zip32.dll in the path
;
;===============================================================================
Func _SevenZipExtract($sArchive, $sOutDir = ".", $sFilter = '*', $sCMDLine = '', $hWnd = 0)

All paramaters, except the archive name, are optional. So your test would be:

_SevenZipExtract("C:\temp\test.zip", "C:\test\new")

EDIT: and you will need the 7ZIP Dll. But I think you knew that, right?

Cheers

Kurtd

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

yep, I have it. Tested your code, and it didn't work. Did this:

File to unzip is usr.zip. It needs to be unzipped with the folder structure intact. I put it inside a msgbox to debug.

#include<sevenzip.au3>
msgbox(0, "",_SevenZipExtract("C:\usr.zip", "C:\test"))

As I said...hurting my brain on this one. I can make it work all day using a batch file, and for a dirty solution, I did that. It is messy however, so I rather get this working without the batch file.

I get a 0 for a return, which tells me the 7zip failed

edit: I needed to put the 7-zip32.dll in the same dir as the script, not just the include directory. I get a 1 for a return, but still nothing gets unzipped.

Edited by vollyman

Share this post


Link to post
Share on other sites

yep, I have it. Tested your code, and it didn't work. Did this:

works perfect here on my system!

edit: I needed to put the 7-zip32.dll in the same dir as the script, not just the include directory. I get a 1 for a return, but still nothing gets unzipped.

again: works perfectly on my system.

#include "SevenZip.au3"
$ret = _SevenZipExtract("c:\temp\7zip\test.zip")
$ret = _SevenZipExtract("c:\temp\7zip\test.zip","C:\temp\7zip\k1")

this creates either c:\temp\7zip\test or c:\temp\7zip\k1\test.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Does it unzip?

hm.. according to his post, YES.

_UnZip($sZip, $sDest)

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

yep, I have it. Tested your code, and it didn't work. Did this:

File to unzip is usr.zip. It needs to be unzipped with the folder structure intact. I put it inside a msgbox to debug.

#include<sevenzip.au3>
msgbox(0, "",_SevenZipExtract("C:\usr.zip", "C:\test"))

As I said...hurting my brain on this one. I can make it work all day using a batch file, and for a dirty solution, I did that. It is messy however, so I rather get this working without the batch file.

I get a 0 for a return, which tells me the 7zip failed

edit: I needed to put the 7-zip32.dll in the same dir as the script, not just the include directory. I get a 1 for a return, but still nothing gets unzipped.

I was messing around with this and downloaded the dll from the above link and inserted it into the same dir as my script. Everything was runnign fine except nothing was unzipping. After poking around I noticed the dll downloaded with an underscore rather then a dash in the file name. Fixed this and everything worked great. So check the filename of the dll you downloaded!

Hope this helps,

MePH

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0