Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes zip a folder structure in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "zip a folder structure in java" Watch "zip a folder structure in java" New topic

zip a folder structure in java

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
I am try to zip the following file structure in my machine,

The problem here is i cant zip the above file structure using java. I have google and found following code sample but it only zip the files only inside a given folder.

In the above code the out is a folder and we need to have some files..also folder cannot be empty if so it throws a exception or cant contain any sub folders even files inside it (ex;out\newfolder\image.jpeg) if so it throws a out\newfolder (Access is denied).

In my case im costructig the above file structure by quering the database sometime empty folders along the folder structure can be have.

Can some one please tell me a solution?

Thank You.>
Rob Spoor

Joined: Oct 27, 2005
Posts: 19656

Please SearchFirst. I have answered the very same problem at least once or twice before.

How To Ask Questions How To Answer Questions
Don't get me started about those stupid light bulbs.
subject: zip a folder structure in java
Similar Threads
Problem in unzipping a folder using API
Losing newlines in text file when zipping
Not able to put some files inside Zip file
Unable to Delete Folder + I can't belive i m posting this :(
Unable to create ,zip file