INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Java unzip fild path problems

Java unzip fild path problems

(OP)
I am not sure the best way to describe what I want to do here, but I will attempt to.

I have a .zip file I want to extract, I have wrote the code to do this and it is working, but I want to "manipulate" the path when writing them to disk.
If I used IZArc to extract this .zip file, it is doing exactly what I want, but I am not sure why or how to make my code do this.

The zip file has a couple upper level folders that I do not care about, or want. The first "file" is located under dir2, so I would like that to be the "top" level folder.

Example (when viewing the zip file using IZARC)

dir/dir1/dir2/dir3/filename
dir/dir1/dir2/dir3/filename2

I understand that there are "folders" under dir and dir1 but all the files are located in dir2 and deeper.

If I extract using my code, the above is what I see in explorer for the directory structure. But if I use IZArc, it is not "keeping" dir or dir1, so the files are unzipped with the top level folder being dir2.

This is what gets saved to disk with my code:

dir/dir1/dir2/dir3/filename
dir/dir1/dir2/dir3/filename2
etc...

This is what gets saved if I use IZArc
dir2/dir3/filename
dir2/dir3/filename2
etc..

It is removing, or not keeping the first two folders...
My guess is because there is not a "file" in them... But just a guess.

I know I can probably manipulate the path or even save them and then move them to where I want, but was wondering if there was a way to have the java do this for me? Maybe a option when creating the ZipFile object or something?

I have looked through the settings of IZArc, to see if I can figure out why or how this program is eliminating those two top folders, but am unable to find anything.   

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close