For Programmers: Free Programming Magazines  


Home > Archive > Java Help > April 2004 > Unzipping Files With Java









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Unzipping Files With Java
martim07

2004-04-30, 1:21 pm

I am curious if anyone has any code for a class that will extract zip
files from folders and place the extracted files in a folder of the
same name on a different hard drive.

For instance, I have a folder called 1998. Within that folder are 60
subfolders, each containing a zip file that contains reports generated
for that day. I would like use a java class in the form of an exe to
loop through all of these subfolders, extract the information in the
zip files, and place the extracted files into a folder of the same
name on a different drive.

I know about the UnZip.java class, I'm just wondering if anyone has a
solution to the situation I mentioned above. I'm stumped. Will someone
please figure out this difficult problem for free and in their spare
time? Thank you.
Christophe Vanfleteren

2004-04-30, 1:21 pm

martim07 wrote:

> I am curious if anyone has any code for a class that will extract zip
> files from folders and place the extracted files in a folder of the
> same name on a different hard drive.
>
> For instance, I have a folder called 1998. Within that folder are 60
> subfolders, each containing a zip file that contains reports generated
> for that day. I would like use a java class in the form of an exe to
> loop through all of these subfolders, extract the information in the
> zip files, and place the extracted files into a folder of the same
> name on a different drive.
>
> I know about the UnZip.java class, I'm just wondering if anyone has a
> solution to the situation I mentioned above. I'm stumped. Will someone
> please figure out this difficult problem for free and in their spare
> time? Thank you.


This is not a difficult problem. You should be able to work this out for
yourself using

http://java.sun.com/j2se/1.4.2/docs...ip/ZipFile.html
and
http://java.sun.com/j2se/1.4.2/docs...va/io/File.html

Just coming in here asking someone to do your work for you for free will not
work. Why don't you use your spare time to learn some Java instead?

--
Kind regards,
Christophe Vanfleteren
Roedy Green

2004-04-30, 1:21 pm

On 29 Apr 2004 11:50:17 -0700, martim07@hotmail.com (martim07) wrote
or quoted :

>I am curious if anyone has any code for a class that will extract zip
>files from folders and place the extracted files in a folder of the
>same name on a different hard drive.


the key is to use a Filter to find the zips. see
http://mindprod.com/jgloss/filter.html

The use open with Zip and extract each element as a set of raw bytes,
and save them with FileOutputStream buffered.

See http://mindprod.com/fileio.htm for sample code.

See http://mindprod.com/products.html#FILETRANSFER
for classes that do what you want, only without zip.
they may be helpful models. You need to do the io in large chunks for
speed. This contains the obvious chunking logic to deal with fixed
size chunks and the leftover.




--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
martim07

2004-04-30, 1:22 pm

Christophe Vanfleteren <c.v4nfl3t3r3n@pandora.be> wrote in message news:<dhckc.90842$A9.5538906@phobos.telenet-ops.be>...
> martim07 wrote:
>
>
> This is not a difficult problem. You should be able to work this out for
> yourself using
>
> http://java.sun.com/j2se/1.4.2/docs...ip/ZipFile.html
> and
> http://java.sun.com/j2se/1.4.2/docs...va/io/File.html
>
> Just coming in here asking someone to do your work for you for free will not
> work. Why don't you use your spare time to learn some Java instead?



I was being sarcastic, Christophe. I don't expect anyone to write a
class for me. Thanks for your input.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com