Want ProgressBar During Zip File Extraction?

i have develop a application
,in which zip file is extracted
.(unzipping a zip file),but i want to show progressbar during zip file extract process,i have tried but i am unable to do that.........plz help me?here is my code.......
====================
mxml file->
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initApp()">
<mx:Script>
<![CDATA[
import com.kfc.repflex.utils.ZipExtractComponent;
import mx.controls.Alert;
[Bindable]
private var zip:ZipExtractComponent = null;
private function initApp():void{
zip = new ZipExtractComponent("C:/AdobeAIRInstaller.zip");
]]>
</mx:Script>
<mx:Panel title="Load and extract ZIP files" layout="vertical" horizontalCenter="0" verticalCenter="0" horizontalAlign="center" verticalAlign="middle">
<mx:Button id="load" label="Load and Extract ZIP" click="zip.loadZIP()"/>
</mx:Panel>
</mx:WindowedApplication>
====================================
action script class->
package com.amdocs.repflex.utils
import com.amdocs.repflex.utils.zip.*;
import flash.events.EventDispatcher;
import flash.filesystem.*;
import mx.controls.Alert;
public class ZipExtractComponent extends EventDispatcher
private var zipInput:File = new File();
private var zipOutput:File = new File();
private var zipFile:ZipFile=null;
private var fileIn:String;
private var fileOut:String;
public function ZipExtractComponent(fIn:String){
this.fileIn=fIn;
//this.fileOut=fout;
public function loadZIP():void
zipInput.nativePath=fileIn;
var stream:FileStream = new FileStream();
stream.open(zipInput,FileMode.READ);
zipFile = new ZipFile(stream);
extractZip();
public function extractZip():void
for(var i:uint = 0; i<zipFile.entries.length; i++)
var zipEntry:ZipEntry = zipFile.entries[i] as ZipEntry;
if(!zipEntry.isDirectory())
//zipOutput.nativePath=fileOut;
//var targetDir:File = new File("C:/Documents and Settings");
var targetDir:File = File.documentsDirectory.resolvePath("");
var entryFile:File = new File();
entryFile = targetDir.resolvePath(zipEntry.name);
var entry:FileStream = new FileStream();
entry.open(entryFile, FileMode.WRITE);
entry.writeBytes(zipFile.getInput(zipEntry));
entry.close();
Alert.show("EXTRACTED SUCCESSFULLY");

I'm running out of suggestions over here.
Your exact command line yields this result:
zip warning: name not matched: in.txt
zip error: Nothing to do! (out.zip)
Well, it should, as I don't have an in.txt. Handing it an existing file, I get this:
zip -P pass out.zip result.txt
  adding: result.txt (deflated 7%)
.. and opening in the Finder correctly prompts me:
so there must be something wrong with your system.
Very Long Shot: What version do you get when you type this? (I can't imagine this is the actual problem, but you never know.)
zip --version
Mine is
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
Currently maintained by E. Gordon.  Please send bug reports to
the authors using the web page at www.info-zip.org; see README for details.
Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip,
as of above date; see http://www.info-zip.org/ for other sites.
Compiled with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) for Unix (Mac OS X) on May 25 2011.

Similar Messages

  • Want To create Zip file  using java,And Unzip without Java Program

    I want to create a zip text file using java, I know Using ZipOutputStream , we can create a zip file, , But i want to open that zip file without java program. suppose i use ZipOutputStream , then zip file is created But for unZip also difftrent program require. We cant open that zip file without writing diff java program.
    Actually i have one text file of big size want to create zip file using java , and unzip simply without java program.Its Possible??
    Here is one answer But I want to open that file normal way(
    For Exp. using winzip we can create a zip file and also open simply)
    http://forum.java.sun.com/thread.jspa?threadID=5182691&tstart=0

    Thanks for your Reply,
    I m creating a zip file using this program, Zip file Created successfully But when im trying to open .zip file i m getting error like "Canot open a zip file, it does not appear to be valid Archive"
    import java.io.*;
    import java.util.zip.*;
    public class ZipFileCreation
         public static void main (String argv[])
         try {
         FileOutputStream fos = new FileOutputStream ( "c:/a.zip" );
         ZipOutputStream zip = new ZipOutputStream ( fos );
         zip.setLevel( 9 );
         zip.setMethod( ZipOutputStream.DEFLATED );
    //     get the element file we are going to add, using slashes in name.
         String elementName = "c:/kalpesh/GetSigRoleInfo092702828.txt";
         File elementFile = new File ( elementName );
    //     create the entry
         ZipEntry entry = new ZipEntry( elementName );
         entry.setTime( elementFile.lastModified() );
    //     read contents of file we are going to put in the zip
         int fileLength = (int)elementFile.length();
         System.out.println("fileLength = " +fileLength);
         FileInputStream fis = new FileInputStream ( elementFile );
         byte[] wholeFile = new byte [fileLength];
         int bytesRead = fis.read( wholeFile , 0 /* offset */ , fileLength );
    //     checking bytesRead not shown.
         fis.close();
    //     no need to setCRC, or setSize as they are computed automatically.
         zip.putNextEntry( entry );
    //     write the contents into the zip element
         zip.write( wholeFile , 0, fileLength );
         zip.closeEntry(); System.out.println("Completed");
    //     close the entire zip
         catch(Exception e) {
    e.printStackTrace();
    }

  • Want to decompress ZIP file

    Hi,
    I have a ZIP file that I want to read and decompress into
    plain files, how can I do that ?
    I've tried to learn how to read in files byte by byte,
    is there any faster way?
    Thanks,
    Alex

    the first example doesn't work correctly, here is a fixed version:
          * Unzip a ZIP/JAR file.
          * @param zipFile ZIP/JAR file to extract.
          * @param destinationDir Destination directory to unzip to.
          * @throws IOException
         public static void unzipFile(File zipFile, String destinationDir) throws IOException {
            final int BUFFER = 2048;
            if (zipFile != null && zipFile.exists() && destinationDir != null) {
                ZipInputStream zis = null;
                BufferedOutputStream bos = null;
                try {
                    zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFile.getAbsoluteFile())));
                    ZipEntry entry = null;
                    while((entry = zis.getNextEntry()) != null) {
                        if (entry.isDirectory()) { //directory
                            File dir = new File(destinationDir + File.separator + entry.getName());
                            dir.mkdirs();
                        } else { //file
                            int count;
                            byte data[] = new byte[BUFFER];
                            FileOutputStream fos = new FileOutputStream(destinationDir + File.separator + entry.getName());
                            bos = new BufferedOutputStream(fos, BUFFER);
                            while ((count = zis.read(data, 0, BUFFER)) != -1) {
                                bos.write(data, 0, count);
                            bos.flush();
                    zis.close();
                } finally {
                    if (bos != null) { try { bos.close(); } catch (IOException ioe) { /* ignore */ } }
                    if (zis != null) { try { zis.close(); } catch (IOException ioe) { /* ignore */ } }
            }//else: input value unavailable
        }//unzipFile()

  • Zip file extraction errors

    Hi, i'm not sure whether this is in the right forum, please feel free to move it if it's not appropriate here.
    I'm trying to extract the contents of a .zip file and i'm getting the following exception:
    java.io.FileNotFoundException: zip test\zip test.txt (The system cannot find the
    path specified)
            at java.io.FileOutputStream.open(Native Method)
            at java.io.FileOutputStream.<init>(Unknown Source)
            at java.io.FileOutputStream.<init>(Unknown Source)
            at unzip3.main(unzip3.java:47)Here is the code i'm trying to run, it's a sample code I picked up off a tutorial. I've looked at a few tutorials and the code is more or less the same in all of them...
    import java.io.*;
    import java.util.*;
    import java.util.zip.*;
    public class unzip3 {
      public static final void copyInputStream(InputStream in, OutputStream out)
      throws IOException
        byte[] buffer = new byte[1024];
        int len;
        while((len = in.read(buffer)) >= 0)
          out.write(buffer, 0, len);
        in.close();
        out.close();
      public static final void main(String[] args) {
        Enumeration entries;
        ZipFile zipFile;
        if(args.length != 1) {
          System.err.println("Usage: Unzip zipfile");
          return;
        try {
          zipFile = new ZipFile(args[0]);
          entries = zipFile.entries();
          while(entries.hasMoreElements()) {
            ZipEntry entry = (ZipEntry)entries.nextElement();
            if(entry.isDirectory()) {
              // Assume directories are stored parents first then children.
              System.err.println("Extracting directory: " + entry.getName());
              // This is not robust, just for demonstration purposes.
              (new File(entry.getName())).mkdir();
              continue;
            System.err.println("Extracting file: " + entry.getName());
            copyInputStream(zipFile.getInputStream(entry),
               new BufferedOutputStream(new FileOutputStream(entry.getName())));
          zipFile.close();
        } catch (IOException ioe) {
          System.err.println("Unhandled exception:");
          ioe.printStackTrace();
          return;
    }It doesn't seem to even be creating the directory for me.
    Any help would be greatly appreciated!

    What do you mean by adjusting my expectation?You expect the zip file to hand you back entries with "isDirectory" returning true, when it doesn't, as you have observed. So you have to change that expectation.
    What do you suggest?For each entry you get, create a File object, invoke the getParentFile() method, and if that returns something (a File object representing the directory the target file belongs to), invoke its mkdirs() method to create the directory/directories the target file will belong to.
    Experiment with it...

  • Zip file extraction fails

    After downloading the trial zip file several time: ie via wireless, ethernet, I've been unable to extract the zip file to began installation of the program. I've downloaded the beta file on 2 different windows7 computers and have unsuccessfully tried to extract the zip file. I receive an error message while attempting to extract the archive.
    Anyone have any thoughts on this?
    Regards,
    Wes

    Nope, it's a zip. All it contains is setup.exe, though.
    @a330,
    Is that the filename and size that you see on your download?
    Hal

  • Error while posting .ZIP file

    Hi All,
    I am working on file to file scenario.. I want to post .zip file from source to target. I am not using any mapping for this... I m using the Integrated configuration for theis scenario.. We are using sFTP advantco adapter for both sender and receiver.
    I am able to post the .zip file with size 50KB only.
    If i send .zip file with more than 50KB size, sender channel picked the file but i am getting the below error in the receiver communication channel.
    Error: Cannot write content to remote file XXXX: Possible causes: SFTP connection is broken or remote file/directory is in use: java.lang.ArrayIndexOutOfBoundsException:  (Software version: 3.0.17)
    How to transfer .zip files with more than 50KB size.
    Thanks,
    Soumya.

    Hi Soumya,
    I see no reason to use sFTP or  advantco for this.
    you can config this scenario using PI regular File adapter, and PI regular File to File scenario.
    in your case you just create an empty DT without fields in Repository, you need to create interfaces (OB,IB) for the Configuration
    this works for me in many scenarios.

  • I cannot open mp3 files I received from a purchased download. They are in a .zip file but no matter what I do, they cannot be opened. Please help.

    I have right clicked and selected open, and the loading ring shows but nothing happens. I have also extracted the files, opened them in itunes and windows media player. (cannot be accesed in itunes or wmp)

    With ZIP files, extract was your best bet. Do the players report that the file is corrupted, or zero length?? You may need to check with the seller on whether the ZIPs downloaded correctly or see whether you can get another format.
    You also could try downloading again using Internet Explorer, if they allow that.

  • Can't Open Zip files

    Everytime it fails. I can't open zip files. Does anyone know why. I have my settings to allow all files when downloading something. When I go to download and it is complete it gives a setup exe. then I click on it and it does nothing.....
    Plesae help...Starting to drive me nuts!

    Hi Booher,
    Zip files are cross platform. Doesn't matter if it's an a PC or a Mac. Either can open or create them. But .exe files are Windows only. An .exe is an application compiled for MS DOS or Windows, as are .com files. They won't work at all on a Mac without running them in a Windows environment such as Virtual PC.
    The only exception is if the .exe is a self extracting archive created on a PC. That is, a .zip file converted to an .exe so if the person the compressed files are sent to doesn't have a way to open a .zip file, it will run as a program to do the same thing. These, OS X can open and extract as if it were still a .zip file.
    You mention that one of the .zip files extracted its contents as a file named setup.exe. This will not work directly in the Mac OS in any way, as it is a Windows application/program.

  • Keynote (6.2) file won't open. Can I make a new Index.zip file using some of the extracted .iwa files?

    Keynote (6.2) file won't open (hung and crashed during auto-OS update).  Trying to salvage everything possible.  I know about grabbing the pictures from Data folder, but is there a way to extract the good .iwa files and make a new Index.zip? 
    Tried extracting, capturing uncorrupted .iwa and deleting corrupted ones, but can't figure out how to re-compress to readable format for Keynote.  Seems silly that I can't ge the new .zip file to work.  There has to be some sort of manual work-around, yeah?
    Thanks.

    This problem has been reported to the AppleWorks team, but I doubt that we will ever hear if there is a fix. AppleWorks 6 is now nearly 6 years old & hasn't even had an update since March, 2004.
    Nothing has been found to be able to make AppleWorks 6.2.9 open the problem files. I've had it happen & not happen with all AppleWorks file types. These files can be opened by any other version of AppleWorks 6, including the OS 8/9 component 6.2.8. If you have the retail version of AppleWorks & have Classic installed, you can "Force" AppleWorks 6 to open in Classic to open the files, save them as AW 6 files & then open them in the OS X version. You do want to make sure you don't have both the Classic & OS X versions of AppleWorks 6 running at the same time. I find it much easier to use AppleWorks 5 in Classic to open & save the files. AppleWorks 6.2.9 has no problem opening AppleWorks 5 files.
    Peggy

  • Extract a zip file

    I have a program that includes a set of around 50 photos.  I have zipped those files and included them in my build.  Now I'd like to extract those photos to a folder during the installation process.  I've reviewed the application builder, but can find no reference to extracting a zip file.
    What am I overlooking?  I'd appreciate any help.  Thanks.

    You can create another executable that can decompress the file. Then, in Application builder, in the "Installer Settings" tab, there is a button that reads "Advanced...". A dialog will open with an option called "Run executable after installation". You can call your decompression executable from there.
    Another option is to check OpenG Builder, which is also an application to deploy LabVIEW software. The zip functions are included, and because is open source, you can modify it so the installer shows the behavior you want.
    Regards;
    Enrique
    www.vartortech.com

  • Can I search zip files for a particular substring in the name and extract the file to a folder?

    I need to search through lots of zip files, looking for files starting with a particular string.  Then extract them to any folder.  Can I do this in CVI?
    thanks

    thanks Wolfgang, but my level of experience is such that I could use a bit more detail.  Do you mean that I might find a .dll and call one of its functions from CVI?   So you know of nothing in CVI that I can use directly?  I don't think that I would want to open the zip, extract all the files, search the folder where they were extracted to, copy the file if it has the target name substring, then rezip.  Or, maybe there is a more direct solution.
    Any thoughts?
    thanks

  • Extracting Zip files using PowerShell 3.0 on Windows 2008

    I’m using a script to extract data to multiple servers, I’ve tested it many times, however an issue has come up that has me stumped. When extracting the zip file, it wants to create a top level folder the same name as the zip file instead of just extracting
    the contents.  Here is a sample of my script. What I need it to do is just extract the contents to the location I specify, but not create a folder with the same name as the zip file itself. Hopefully that makes sense.
     ( now the code I used is from a sample I found online, it’s been edited to fit my needs.
    $Date
    = Get-Date
    #ERROR REPORTING ALL
    Set-StrictMode
    -Version latest
    #STATIC VARIABLES
    $search
    = ""
    $destSRC  
    = "D:\Destination\DestinationUpdate"
    $zips  
    = "D:\Source\ZipSource"
    #log start of script
    Write-EventLog
    -LogName OpsCenter
    -Source ZIP
    -EntryType Information
    -EventId 3001
    -Message "Start Extraction of Update files to
    $destSRC @
    $Date"
    #FUNCTION GetZipFileItems
    Function
    GetZipFileItems
    Param([string]$zip)
    $split =
    $split.Split(".")
    $destSRC
    = $destSRC
    + "\"
    + $split[0]
    If (!(Test-Path
    $destSRC))
    Write-Host "Created folder :
    $destSRC"
    $strDest
    = New-Item $destSRC
    -Type Directory
    $shell   =
    New-Object -Com
    Shell.Application
    $zipItem
    = $shell.NameSpace($zip)
    $items   =
    $zipItem.Items()
    GetZipFileItemsRecursive
    $items
    #FUNCTION GetZipFileItemsRecursive
    Function
    GetZipFileItemsRecursive
    Param([object]$items)
    ForEach($item
    In $items)
    If ($item.GetFolder
    -ne $Null)
    GetZipFileItemsRecursive
    $item.GetFolder.items()
    $strItem
    = [string]$item.Name
    If ($strItem
    -Like "*$search*")
    If ((Test-Path ($destSRC
    + "\"
    + $strItem))
    -eq $False)
    Write-Host "Copied file :
    $strItem from zip-file :
    $zipFile to destination folder"
    $shell.NameSpace($destSRC).CopyHere($item)
    Else
    Write-Host "File :
    $strItem already exists in destination folder"
    #FUNCTION GetZipFiles
    Function
    GetZipFiles
    $zipFiles
    = Get-ChildItem -Path
    $zips -Recurse
    -Filter "*.zip"
    | % {
    $_.DirectoryName
    + "\$_" }
    ForEach ($zipFile
    In $zipFiles)
    $split =
    $zipFile.Split("\")[-1]
    Write-Host "Found zip-file :
    $split"
    GetZipFileItems
    $zipFile
    #RUN SCRIPT
    GetZipFiles
    #log end of script
    Start-Sleep
    -Seconds 2
    $Date
    = Get-Date
    Write-EventLog
    -LogName OpsCenter
    -Source ZIP
    -EntryType Information
    -EventId 3001
    -Message "Extracted all ZIP Update files to
    $destSRC @
    $Date"
    Paul Arbogast

    @jrv
    I hate to hijack an old thread.
    I have been playing with this for the past hour.
    I have use this fine in an interactive console or the ISE.
    But as soon as I place this into a script, and then run the script " .\script.ps1 "; nothing happens.
    I obviously have some disconnect going on that I am not finding.
    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Disclaimer: Attempting change is of your own free will.

  • Problems creating/extracting ZIP files, anyone?

    Greetings,
    I am having some odd bugs with OSX in creating and extracting ZIP files.  I’m curious if anyone else has run across this or if anyone has any remedies to suggest.
    The issue is that when I extract a ZIP archive, the extracted files have their creation dates and modification dates changed from the original versions.  For example, I have a directory created in 2010 and all the files were created and last modified in 2010.  However, when I ZIP the directory and re-extract it, many of the file dates change.  Some files have the creation dates changed so to match the last modified date.  In other cases, both the creation date and modification date are changed to something later than both, perhaps the date the directory was ZIPed or the date the directory was extracted.  And some files don’t seem to have the dates changed. 
    I have tried various options, such as terminal, and third party programs (BetterZip, Keka, Stuffit, & Archiver to name a few) and they all seem to have some variation of this behavior.  I have tried creating the Zip with one program and extracting with the other, and still this behavior persists.  Different files seem to be affected with each combination of creating and extracting programs. 
    Another odd behavior was that I tried password protecting some directories with financial data, and OSX could create the ZIP file with the password, but OSX could not unzip the file with the password it created for some files.  In every case, third party program could unzip the files with the password created in the terminal command.  This seem to happen inconsistently. 
    I have tried creating a dummy account and tested it in that account, with similar results.
    I’ve read the man page for the command line version of ZIP to see if there is some -option to preserve dates, but found nothing.  The typical command looks like this:
    > zip -er filename.zip  sourceDir
    > unzip filename.zip
    File types include directories, PDFs, Text docs, Quicken files.  Ive tested other directories too with other file types.  It doesn’t seem to affect every file, but seems unpredictable.  Luckily, I still have the original uncompressed version of most directories.  But I really want to archive some directories and unarchive them when needed.  The dates matter to me because they are mostly financial files and I use the dates to know what versions were used for taxes and other things.  Also, if dates change, then backup programs start replacing the good backups with files with the corrupted dates. 
    I’d appreciate any suggestions or feedback.  I there some bug in the ZIP protocol?  Is there some bug in OSX file system that is corrupting the dates with the archive and unarchive process? 
    Thank you for any suggestions-
    OSX 10.9.5,
    MBPro 2012

    OK, sorry did not read it correctly.  Read the first sentance and quit.
    No, Bridge is just a browser.  You can extract more than one file at a time in Win. Explorer.  You have to do them individually, but can run multiple extractions at the same time.
    There are other zip/unzip programs out there.  I know the the CS6 beta a number of users could not open it with WinZip and used alternate product just fine.

  • FSCM MP9 - unable to extract the zip file EODS_QUERY_FIX

    Hi,
    I am applying FSCM 9.1 Maintenance Pack 9 on Finance application.
    During on estep I need to apply the project, which can be found on EODS_QUERY_FIX.ZIP
    "Please locate EODS_QUERY_FIX.zip in upd878541\upd878541_install and manually apply the project to your Database."
    I am unable to extract the zip file.
    It's high appreciated if some one can help me in extracting or identifying the project.
    Thank You!
    Best Regards
    Soundappan

    Hi,
    I had the same exact issue yesterday. From my install workstation I was unable to open the zip file but from another PC I could open it with no errors, so I've copied the archive I could open from my PC to my install workstation and still I could not open it.. very strange.
    The difference between my PC and the install workstation was that on my PC I'm using 7zip and on the install workstation I'm using WinZip.
    So I've extracted the zip file with 7zip on my PC then, still on my PC I've recreated a new zip file, transferred this to the install workstation and finally I could open it!
    Hope this helps

  • How to create a self-extracting downloaded Zip file ...

    I have a question about Mac file compression for an eBook PDF.  I know how to compress the file with Mac OS X 10.8.5.  I right-click the PDF I want to compress and select "Compress <file name>" from the Contextual Menu.  The file is compressed as a ZIP file.  The file I'm compressing will be distributed from a web server to Mac users.
    SITUATION:  I want the Mac user to be able to download the ZIP file to their Mac.  Once the ZIP file is downloaded to their Mac, I want the ZIP file to automatically open to place the eBook PDF on their desktop - so please indulge me here.  I know that a Mac user only needs to double-click the ZIP file to extract the eBook PDF, BUT, IF POSSIBLE, I want this to happen automatically after the ZIP file is downloaded.
    QUESTION:  Is there any way to automatially extract the eBook PDF from the ZIP file once the Mac user downloads the ZIP file to their destop?  If so, how do I do this?  If not, is there anyother way to do this that does not required any additional software like StuffIt Expander to decompress the file?  As an aside, If I compress the eBook PDF using Mac OS X 10.8.5, is this compressed ZIP file compatible with older versions of Mac OS, i.e., can they double-click the compressed ZIP file to open it?
    Thank you in advance for your comments and help . . .
    Jim Minor
    Email: [email protected]

    In OSX, zip extraction depends on the browser and browser settings. For example, Safari will open files automatically depending on this setting in Sarari Preferences: So the short answer I think is no. Your zip recipients are going to have to click on the zips to open them if their browser is not set to open them automatically.
    I'm no zip expert but I would think a zip is a zip and should be compatible with older versions of OSX. That is, 10.4 or later, which didn't include Stuffit any more. Earlier versions would need Stuffit or something similar.

Maybe you are looking for