aspose file tools*
The moose likes Java in General and the fly likes Problem in creating a zip file 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 "Problem in creating a zip file java" Watch "Problem in creating a zip file java" New topic
Author

Problem in creating a zip file java

sAsho wagh
Greenhorn

Joined: Jan 18, 2011
Posts: 3
I have the following code to create the zip file in java


In c:/reports/reports/reports/reports/reports there are several files which I want to zip in zipFile.zip in the same directory.
The above code does the same....

But when I extract the zip file I get the directory structure like this ..../reports/reports/reports/reports/reports
and the files in the last folder..

I want only the files when I exctract the zip file.......

Suggest something.........
Thanks in advance................
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19784
    
  20

Welcome to the Ranch!

Don't add your files using absolute paths. Use relative paths instead.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
sAsho wagh
Greenhorn

Joined: Jan 18, 2011
Posts: 3
But how would I get the relative path of the file..........

The executable file laction may be chaned in that case what should I do..........
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3742
    
  16
The name that appears in the zip file, including the path, is specified by what you pass to the ZipEntry constructor, so you need to change that.


Joanne
sAsho wagh
Greenhorn

Joined: Jan 18, 2011
Posts: 3
Hey Thanks Joanne Neal..........

It Works now.............
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in creating a zip file java