Unzip a file preserving the folder structure

Hi guys,
I have create a zip file using java.util.zip and I preserv all directory structure. When I unzip the file using the same library, in the loop of ZipEntry I don't find never a directory. This the code that I use and don't work:
public void dataDecompression(String pathArchivio) {
    try {
        fileInputStream = new FileInputStream(pathArchivio);
       checkedInputStream = new CheckedInputStream(fileInputStream, new Adler32());
       zipInputStream = new ZipInputStream(new BufferedInputStream(checkedInputStream));
       ZipEntry entry;
       while((entry = zipInputStream.getNextEntry()) != null){
            if(entry.isDirectory()){
                 //make dir          
           else{
                //write file
}Maybe I miss something in compression? Excuse for my bad english.
Thanks in advance.

three problems with that.
1) you don't recusively create folders.
2) you create a folder with the name of the file you want to write.
3) you don't create files.
File file=new File(entry.getName());
if(file.getParentFile()!=null);
     file.getParentFile().mkdirs();
if( !entry.isDirectory() ) {
//code that write file;

Similar Messages

  • Ann: LR2/TreeExporter - Export your images while preserving the folder structure

    Hi,
    I've just released a new plug-in that'll export images whilst preserving the original folder structure.
    The plug-in scans the images to be exported in order to determine the deepest folder that contains all the images, and then exports the tree from this point (although you can optionally choose to start higher up) to your destination.
    Real time examples are given so that it's very clear what's going to happen.  The UI is polished and easy to use.
    More details here:
    http://www.timothyarmes.com/lr2treeexporter.php
    and don't miss the quick guide:
    http://www.timothyarmes.com/lr2treee...sec=quickguide
    As usual, comments and feature requests are welcome.
    Tim

    Hi,
    Unfortunately the SDK doesn't offer access to this
    information.
    I hope some day it will...
    SDK should provide methods to enumerate collections.
    Even if it did this would probably not be possible
    since a photo can belong to many collections.
    But this is not a problem - copies will be duplicated in correspondent folders.
    Regards,
    Grafin

  • [svn:osmf:] 16197: Config file changes to reflect the folder structure changes of libs and plugins

    Revision: 16197
    Revision: 16197
    Author:   [email protected]
    Date:     2010-05-18 15:07:01 -0700 (Tue, 18 May 2010)
    Log Message:
    Config file changes to reflect the folder structure changes of libs and plugins
    Modified Paths:
        osmf/trunk/apps/samples/framework/DynamicStreamingSample/DynamicStreamingSample-build-con fig.xml
        osmf/trunk/apps/samples/plugins/AkamaiPluginSample/AkamaiPluginSample-build-config.xml
        osmf/trunk/framework/OSMFAIRTest/OSMFAIRTest-build-config.xml
        osmf/trunk/framework/OSMFIntegrationTest/osmfintegrationtest-build-config.xml
        osmf/trunk/framework/OSMFTest/OSMFTest.mxml
        osmf/trunk/framework/OSMFTest/osmftest-build-config.flex
        osmf/trunk/framework/OSMFTest/osmftest-build-config.flexcov
        osmf/trunk/framework/OSMFTest/osmftest-build-config.xml

    Grant,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

  • I have several pdf files in my computer which are organized in folders. I want to transfer them to IBooks (in my Ipad) and keep the folder structure I use in my computer. Is it possible to do it? Do I need any other app?

    I have several pdf files in my computer which are organized in folders. I want to transfer them to IBooks (in my Ipad) and keep the folder structure I use in my computer. Is it possible to do it? Do I need any other app?

    By design, the organizer (and any other database management systems) is there to prevent you from duplicating your media files. The catalog management allows you to have the same image in different categories or albums. Duplication in different folders is to be absolutely avoided.
    The same image file can have multiple tags like 'family', 'vacations', 'birthdays' and be present in three different albums with the same names. On obvious advantage is less disk space. Another one with your present folder system is that if you edit one of your duplicates, the other ones are unchanged.
    I don't see an easy way to make your present folder structure simplified for the organizer ...

  • How can I upload multiple files or whole folder structures in one go to the Cloud?

    How can I upload multiple files or whole folder structures to the Cloud in one go? Uploading lots of files singularly does not help my workflow.
    All help is much appreciated.
    Paul.

    Hi,
    Uploading multiple files is browser specific.
    Internet explorer won't allow to select and upload multiple files on the cloud.
    If you want to upload multiple files then you have to login to Cretaive cloud using Firefox or Chrome web browser, then you can select multiple files in the Browse window to upload.
    You can't upload folders directly.
    Thanks,
    Baljeet

  • How to get the folder structure using Sevlets

    Hi....
    I have to retrieve the directory structure on the server and display it
    to the user. Once the user selects a folder from the tree, the files
    have to load on a different pane. Of course the folder structure could
    change on the server if any folder or file is added. In short, i have
    to get something like the windows file explorer.Also I need to get the path to a particular folder in the server. Is it possible to do
    this with using servlets. If we can do this using
    servlets, how can i retrieve the folder structure and send it to the
    user interface?
    Can somebody help me to do this please.....
    Thanks!

    I need to get the path to a particular folder in the
    server. Is it possible to do
    this with using servlets.You can use:
    String thePath = getServletContext().getRealPath("/WEB-INF/someDir/somefile");
    If we can do this using
    servlets, how can i retrieve the folder structure and
    send it to the
    user interface?You could try using a File object and its method listFiles() or some of its other methods.

  • Building a war file with a folder structure

    How do a build a war file with a folder structure? I have code that creates JarEntrys and writes jar files and resource files etc. to the war. When I look at the war that gets created using winzip the path names for all the entries are correct and everything appears correct. When I try to deploy this to Tomcat nothing deploys. It appears my war is in a folder structure. How can a build this folder structure in the war? When I look at a good war using BeyondCompare I see folders and files in the folders just like I would see looking at a directory on my system. When I use BeyondCompare to view one of my "bad" war files that I have created everything is in the root. There are no folders and no folder structure. I am using the java.util.jar API to create the war but I don't see any methods or any API that will let me build up any sort of folder structure. It seems like I am missing something basic here.

    command is same for creating jar/war/ear.
    u simply need to execute jar /? for detail.

  • When moving a file using drag and drop, as I hover over the destination folder it no longer opens, so I can't drop the file into the folder.  Why?

    When moving a file using drag and drop, as I hover over the destination folder it no longer opens, so I can't drop the file into the folder.  Why?  I have a heirarchical embedded folder structure under \Documents.  Usually, as I drag the file to be moved over the various folders, they will blink twice, then expand/open to reveal contents (in Finder).  Now, when the file to be moved is held (hovering) over the destination folder, it will not blink or expand, so there's no place to drop the file.  If I release the mouse button, the file image disappears, showing that it is "going back to the place it came from", a.k.a. was not moved.  This just started happening.  I noticed it after upgrading to Mavericks.  Is this a bug or could anything else be causing this?

    As of today, Apple Support discovered during a remote support session with me that the same thing happens on their own system.  It is isolated to "Column View"; the Icon and List views in Finder behave correctly.  Issue is being escalated to engineering, and Apple will call to report status in a couple days.  In all likelihood, this is a bug that will need to be addressed in a future update.

  • Change the folder structure in Adobe Muse?

    I have a website created in Adobe Muse, but I don't like how all the pages are shown like this in the address bar: http://www.mydomain.com/musefile.html no matter where on the site you are.
    I'm publishing the site through Business Catalyst, but I'm afraid of tinkering with the file structure in there. I really would like to put the html files into subfolders so I can create a structure like this: http://www.mydomain.com/submenu1/index.html
    Then I could have all the different menu categories into subfolders, and the links in these categories in the correct subfolders.
    How do I go about doing this?
    You can see the temporary site at www.copycat.as

    Hi,
    Beacause Muse doesn't have an option for creating folders it is not possible to create the desired structure in Muse and this folder structure will have to be created in BC or if you choose to connect over FTP to your site.
    If you need help using FTP go through this article: http://kb.worldsecuresystems.com/153/bc_153.html (it's easier to create the folder structure).
    What will be helpful in this case, and Muse will keep all the configurations inside your project, will be to create your menu items manually and specify the path for your files using the field next to the Hyperlink for each item. However, this method is not recommended unless you know how links works on different levels (folders)
    I hope this gives you a clear view about how it can be done.
    Regards,
    Cristian

  • How to import files and convert folder structure to collections hierarchy?

    My RAW files are organised on disc by date, e.g.
    2013
    01
    02
    etc
    2014
    01
    02
    etc
    2015
    01
    2015-01-05 Family outing
    2015-01-27 Walk along the Canal
    etc
    02
    2015-02-01 Visiting granny
    2015-02-05 Golf
    2015-02-07 Skating competition
    etc
    I would like to batch import these into Lightroom (Lightroom CC) and have the folder structure above replicated in Collection Sets and Collections (i.e. one collection set for each year, and within each one have a collection set per month, and within that individual collections for the folders)
    Is there a way to make this happen automatically?
    Many thanks,
    /alan

    Hi.
    Trash the iPhoto Library folder that you created on your Mac, or rename it "iPhoto Library damaged" if you may need some of its contents. Copy the iPhoto Library folder from the backup into your Pictures folder. Hold down the Option key as you launch iPhoto and select "Choose Library" from the dialog. Navigate to the good iPhoto Library folder and open. iPhoto should launch and open your library in exactly the same condition it was in when the backup was made. If all goes well you don't have to import anything.
    If the library is still missing items, you can try a database rebuild. Hold Command and Option while you launch, select the first 3 options in the dialog, and rebuild. This can fix a library with a slightly damaged database.
    If the library still isn't working you may have to create a new library (Option-Launch, select "Create") and import your Originals folder from the backup library. This will give you the pictures back without creating duplicates, but your albums and other items will not be recovered.
    Regards.

  • How can I "see" the folder structure behind the iPhoto-library?

    Within iPhoto (iLife 8) I can right click on a picture and, through Show File, find it in its respective subfolder. BUT, when I go to finder and highlight the iPhoto library in Pictures, I only get information about the total library (size, location etc,) but not its underlying folder and subfolder structure(as was customary in iPhoto6). What changes in settings do I need to make to show the folder-structure?
    Thanks in advance
    Veit

    Viet
    What changes in settings do I need to make to show the folder-structure?
    None, you can't do it.
    With iPhoto 7 (iLife 08) the old iPhoto Library Folder is now a Unix Style Package File. The change was made to the format of the iPhoto library because many users were inadvertently corrupting their library by browsing through it with other software or making changes in it themselves. You can look inside there simply by right-clicking on the iPhoto Library and going 'Show Package Contents'.
    However, It is strongly advised that you do not move, change or in anyway alter things in the iPhoto Library Folder as this can cause the application to fail and even lead to data loss. There are no user serviceable parts in the iPhoto Library.
    There are many, many ways to access your files in iPhoto:
    For 10.5 users: You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Apple-Click for selecting multiple pics.
    Uploaded with plasq's Skitch!
    To upload to a site that does not have an iPhoto Export Plug-in the recommended way is to Select the Pic in the iPhoto Window and go File -> Export and export the pic to the desktop, then upload from there. After the upload you can trash the pic on the desktop. It's only a copy and your original is safe in iPhoto.
    This is also true for emailing with Web-based services. If you're using Gmail you can use THIS
    If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    Or, if you want to access the files with iPhoto not running, then create a Media Browser using Automator (takes about 10 seconds) or use THIS
    Other options include:
    1. *Drag and Drop*: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    2. *File -> Export*: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    3. *Show File*: Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.
    You can set Photoshop (or any image editor) as an external editor in iPhoto. (Preferences -> General -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop or your Image Editor, and when you save it it's sent back to iPhoto automatically. This is the only way that edits made in another application will be displayed in iPhoto.
    Regards
    TD

  • Is there any way to maintain the folder structure using the audio converter

    hi, please, i need help
    I want to convert some 24 bit wav files into 24 bit Apple Lossless files.
    dBpoweramp converter doesn't allow 24 bit files for Apple Lossless
    iTunes doesn't keep the folder structure, is there any option to change that?
    thanks

    When iTunes does a format conversion, it stores the new file in an Album folder within an Artist folder. It does not matter where the original file is. It does not provide any other option.

  • What is the folder structure for iTunes for Ver. 11.0.5

    What is the folder structure for iTunes for Ver. 11.0.5 since I have iTunes on an external drive at the moment but want to move it back to the HD temporary so as to back it up to TM, the problem is that it seems that the files are some what disarranged and I'm not sure where and how iTune reads them.

    Time Machine will back up connected external drives as long as they are not on the exclude list.
    Connect the drive with your iTunes library > System Preferences > Time Machine > Options > if the external drive with the iTunes library is listed, select it and click the minus sign then run the Time Machine backup

  • When using Iphoto to import photo from existing folder, what happens if I delete the photo in Iphoto ? Will the original file in the folder be deleted too?

    When using Iphoto to import photo from existing folder to iphoto, what happens if:
    1. I delete that photo in iphoto? will the original file in the folder be deleted too ?
    2.  when importing, does the hard disk store 2 versions of the photo, hence occupying additional space in the harddisk?

    1 - no  --  iPhoto only manages fiel within the iPhoto library - it does not ever do anything with files outside the library
    2 - No idea what you are asking - by default (and strongly recommended) iPhoto copies the original to the iPhoto library and you delete the source file outside the iPhoto library - iPhoto alwasy has at least two versions of every photo and some times three - it always have the original, a thumbnail and once a photo is modified a preview - this is not optional - if it is not what you want then iPhoto is not the correct progrtam to be using for phopto management
    LN

  • Is there a way to separate raw files from jpegs that are in one folder after downloading from camera when you shoot both together. I tried arrange or sort  by kind but that does not work. It arranges all folders but not the files in the folder., Is there

    Is there a way to separate raw files from jpegs that are in one folder after downloading from camera when you shoot both together. I tried arrange or sort  by kind but that does not work. It arranges all folders but not the files in the folder., Is there a way to separate raw files from jpegs that are in one folder after downloading from camera when you shoot both together. I tried arrange or sort  by kind but that does not work. It arranges all folders but not the files in the folder.

    Bridge will do the job. View > Sort > ByType. Then you can choose a group of one type and put the files in a separate folder.

Maybe you are looking for

  • Application crashes nearing 28 concurrent transactions

    Its been a while folks.... I used to post and answer allot here back in the day when i was coding in CF daily. Here is the problem... more details will follow when I get them. I was tasked by my director to look into a problem for an application on t

  • [Solved] Compiling a new kernel with ABS

    I've made it through the whole process outlined in the wiki, up to installing with pacman.  Pacman is telling me that the stock arch kernel is a conflicting package and wants to remove it.  I want to hang on to it in case I've messed something up.  W

  • One of my phones did not get the 2.2 update

    I have two Droids and one automatically had the prompt for updating to the 2.2 but the other did not. How do I update that phone?

  • Date Validation Problem

    My Problem is during a transformation a field in the source table which is varchar2(6) is being populated into target table field whose data type is date. In the transformation they are checking if the source field is a valid date and only then they

  • Messages from one account disappear from inbox

    I run three email accounts into my Mail (4.2), including mobile me and a University (IMAP) account, on a MacBook Pro with Snow Leopard. Recently, and for no good reason I can see, the emails from the Uni account have started only to show in the inbox