Copy *.xml file from zip to another dir without unpacking the zip using java
<p>Hy all,</p>

<p>is i have a bunch of *.zip files in this files are alot of *.log files and other stuff and one *.xml file.</p>

<p>I need to finde the file and copy it to another dir. </p>

<p>So far I finde the file in the *.zip folder
but now I stuck.
Hope you Guys can help...
Thanks</p>

<p>following code I have so far: </p>

<pre><code>public static void main(String[] args) 
    {
        String sPath = "c:/results/";
        //String sFiles;
        File folder = new File(sPath);
        File[] aListOfFiles = folder.listFiles();

        try
        {
            //get all files in the folder 
            for (int i = 0; i &lt; aListOfFiles.length; i++)
            {
                if (aListOfFiles[i].isFile())
                {
                    //get path an file name
                    String sZipPath = aListOfFiles[i].getAbsolutePath();
                    //System.out.println("Absolute Path: " + sZipPath);

                    //open zip find the xml
                    ZipFile sourceZipFile = new ZipFile(sZipPath);
                    Enumeration e = sourceZipFile.entries();

                    while(e.hasMoreElements())
                    {
                        ZipEntry entry = (ZipEntry)e.nextElement();
                        String isXML = entry.getName();

                        if (isXML.endsWith(".xml"))
                        {
                            System.out.println(isXML);
                            //copieFile(File isXML,)
                        }
                    }

                }
            }
        }
        catch (IOException ioe)
        {
            System.out.println("Error while opening zip file " + ioe);
        }
</code></pre>
