Compress KM documents in a ZIP file

Hi everyone,
Someone has already developed a program that lets compress KM documents in a ZIP file?
Thanks & regards
Hassan

GaryJSF wrote:
Hi,
I have code similar to the one below and it is working but I would like to add a directory to the zip file to do something like:
test.zip
Folder1
file1
file2
Folder2
file3
Zip files don't use a folder structure per-se, they use slashes to delimit path segments:
ZipEntry entry = new ZipEntry("Folder1/");
ZipEntry entry = new ZipEntry("Folder1/file1"); //etcTry it and if you have trouble come back and ask insightful questions.
Edited by: endasil on 7-Oct-2009 2:11 PM

Similar Messages

  • Compressing a folder creates two zip files

    I've got a folder called Blanks/ABC FM/SMS/Other and when I compress it I get two zip files of the same size: one with the correct name and the other called Archive.zip. When I remove the space I only get the Archive.zip. When I remove the slashes I get the correct zip file only.
    Is this a bug that I should report? How?

    If you were expecting C/D to compress to C/D.zip instead of Archive.zip I think I have an explanation for that.
    The unix file system which is the underlying OSX file system uses slash (/) as a path delimiter.  So to use an example like yours, if you create a folder A on the desktop and B within A then that the pathname is A/B.  But in reality, being on your desktop it is /Users/you/A/B, where you is your user id.
    The finder tries to allow as many characters as it can for filenames.  But the slash it cannot allow in a filename when recorded in the file system.  So what it does is actually change the slash to a colon in the actual filename.  Thus the filename "A/B" in the finder is, in reality, "A:B" in the file system.
    I think this colon-equals-slash naming convention is what causing the finder's Compress to treat the name specially and it just changes it the output to be the generic Archive.zip.
    Compress is there as a convenience.  There's lots of other ways to do zips.  There's third party utilities.  There's zip command in the terminal (where you can play the finder's game and generate A:B.zip so that it displays in the finder as A/B.zip).

  • Download files from document library in zip file using javascript

    Hi,
    I am developing SharePoint Hosted App which needs to download all the files in the document libraries of SharePoint site in a zip folder where in that zip file each document library should be a folder, in that folder the files of that document library will
    be shown. Currently I am display all the document library in a table with check boxes as shown in the below figure. Now when user selects the check boxes and click on download button, the selected document libraries along with the files should be downloaded
    in a zip folder. This should be achieved through javascript. Can anyone share me the code to solve this problem.
    Thanks & Regards,
    Kishore
    Kishore

    You can use
    zip.js, but the best way - implement your solution on the server-side.
    [custom.development]

  • Compression failed message when downloading zip files. Any suggestions never had this issue before.

    Hi using a site i always have used when downloading something it downloads then when it is about to open the zip file it says decompression failed. Any suggestions i googled many solutions nothing seemed to work.
    Here is my mac book info if it helps.
    thanks
    Model Name:          MacBook
      Model Identifier:          MacBook1,1
      Processor Name:          Intel Core Duo
      Processor Speed:          2 GHz
      Number Of Processors:          1
      Total Number Of Cores:          2
      L2 Cache:          2 MB
      Memory:          1.25 GB
      Bus Speed:          667 MHz
      Boot ROM Version:          MB11.0061.B03
      SMC Version (system):          1.4f12
      Serial Number (system):          4h639627u9c

    A restart shouldn't do any harm at all, since you sync everything make sure you don't restore.

  • Can I delete files once I compress them into a zip file?

    I am trying to get more space in my hard drive. One of the suggestions is to compress files I don't use. Once I compress them into an archive zip file, it looks like the files are still there.  I'm thinking that I should delete the original files but am afraid to do so. What percentage space do I save when I compress?

    What percentage space do I save when I compress?
    That depends on the type of file. Files that are already compressed, such as most media files, won't get smaller, and they may get larger. Text files will compress by about half, on average, but that will probably save a negligible amount of space.
    The right solution to your problem is to move the files you don't often need to an external hard drive. That drive must be backed up along with the internal one.

  • Windows User Says She is Not Receiving All Zipped Files I Send on Mac

    Hi,
    I am using a MPB running Snow Leopard, Version 10.6.8, and I send a weekly batch of seven Word documents in a zip file to a client using Archive Utility. However, lately she has told me she has gotten six files, then a folder that is called "Mac OSX", and within that folder are the same six files, and she never sees the seventh one. When I send the same zip file that I send her to myself in Gmail, and I get the seven Word docs as expected. Does anyone know what might be going on? I am perplexed, especially because I cannot reproduce it on my end. Oddly enough, she says she got all seven files last week, but not this week, or two weeks ago, so it doesn't happen consistently, but I told her I'd try and sort it out.
    Thanks!

    Try the following document, only be sure that none of the boxes in the compatibility tab are checked (not just the compatibility mode box itself): 
    iTunes for Windows: How to turn off Compatibility Mode

  • I have a 2007 iMac with version 10.6.8.  When downloading "some" files to my computer, these files become "zip files."  When I open the zip file, it produces a document in some coding language. How can I open the file to produce a legible document?

    I have a 2007 iMac with version 10.6.8 and 4GB of expanded memory.  When downloading "some" emailed documents, the downloaded file becomes a "zip file," which when opened looks like a coded message.  How can I open the "zip file" so that it produces a legible document?  Please, help!!  thank you!!!

    A "zip file" is a compressed file. "Zipping" in principle does not and cannot change the contents. So that if the contents before zipping are garbage, or unreadable on a Mac, when you expand the file you will get garbage or an unreadable file.
    The first thing to verify therefore is whether the file, before it was zipped, was in a "Mac friendly" format. Can you do that?
    You do not need an App to zip or unzip. These functions are built in on our Macs.
    And yes, zipping and unzipping using the built in functionality, work fine in OS 10.6.8. And 10.7 and 10.8 and 10.9.

  • I am trying to save a document with the new pages and it will only save as a zip file any ideas on how to change this?

    I am trying to save a document with the new Pages and it is only saving as a ZIP file anyone know how to fix this or choose a different file type?

    Take a look at the FileSelector
    First make sure the FileSelector is expanded so you can see the directory and sidebar. That's what the little disclosure triangle up by the filename is for. Once the FS has been expanded to look like the above picture, look to see what subdirectory has been selected. Use the SideBar to select an appropriate one.

  • Reading a Compressed File from a ZIP File, which is an entry of ZIP File

    Hello, Experts,
    Would it be possible somebody to help me with code example for the following problem?
    I want to read a compressed file from a ZIP file, which is an entry of ZIP File, without extacting/writing files on file system. Is this possible?
    Lets say we have a ZipFile1. There is ZipFile2 inside ZipFile1. And inside ZipFile2 is FileA. The scenario is reading FileA without extracting on file system.
    Thank you in advance for your help.
    Cheers
    RADY

    The classes you want to be using are java.util.zip.ZipInputStream and and ZipEntry from the same package. Construct the ZipInputStream with the input you have for the outer zip. Loop with ZipInputStream.getNextEntry until you find the inner zip you're looking for - that method returns a ZipEntry, and you get the name of the zip entry with ZipEntry.getName. Read the ZipInputStream from that point into some buffer, and read that buffer into a new ZipInputStream - rinse and repeat until you have the contents of the file in the zip in the zip...

  • Process multiple documents in zip file without using ccBPM in PI

    Hi,
    Is it possible for PI to handle multiple documents within a zipped source file without the use of ccBPM?
    For example, I have an incoming source zip file containing 0.pdf, a,xml, z.pdf respectively,  After having the sender communication channel uncompress the zip file, each pdf file should be pushed to a directory on a file server, and the xml file should go through a message mapping.
    Is this possible to process all of the files without the use of ccBPM?
    Regards,
    Jim

    Hi Michal,
    Thank you for your response.  The example I provided is just one potential case.  In general, the zip file will always contain 1 xml file and 0-n PDFs, Word docs, or other types of documents.  Also, the first file in the zip may not always be the xml file, which is what I was trying to portray by my example.  Since I am not sure how many non-xml files will be included, I did not know if I could handle all of them directly, without ccBPM.
    At this point, I am leaning towards using a script preprocessor to uncompress the zip, then for each file found, push the xml file to an NFS channel which will process/map the xml, and push every other file type to another NFS channel to copy these documents to a predetermined directory on a predetermined server.
    What are your thoughts on this approach?
    Thanks and Regards,
    Jim

  • Problem with compressing unicode file names in zip file

    Hi Everyone,
    I have a problem while compressing the unicode file name in a zip file. I used the below code for compressing the unicode files.
    String[] source = null;
    // C:\\TestData\\unicode_filename.txt :  unicode_filename.txt is the file created in japanesse language
    source = new String[] {"C:\\TestData\\temp_properties.xml","C:\\TestData\\unicode_filename.txt" };
    byte[] buf = new byte[1024];
    // Create the ZIP file
    String target = "C:\\TestData\\target.zip";
    ZipOutputStream out = new ZipOutputStream(new FileOutputStream(target));
    // Compress the files
    for (int i = 0; i < source.length; i++)
         FileInputStream in = new FileInputStream(source);
         // Add ZIP entry to output stream.
         String fileName;
         File tempFile;
         ZipEntry zipEntry = new ZipEntry(source[i]);
         fileName = zipEntry.getName();
    zipEntry = new ZipEntry(fileName);
    zipEntry.setMethod(ZipEntry.DEFLATED);
    getUTF8Bytes(source[i]);
    // here I'm unable to find the unicode files and not able to understand.
    out.putNextEntry(zipEntry);
    // Transfer bytes from the file to the ZIP file
    int len;
    while ((len = in.read(buf)) > 0) {
    out.write(buf, 0, len);
    // Complete the entry
    out.closeEntry();
    in.close();
    // Complete the ZIP file
    out.close();Please help me how to fix this issue.
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    Thanks for your time for looking into my query.
    Please check the below code for debugging the issue and throw your comments/suggestions for fixing the issue.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    public class ZipTest
      public static void main(String[] args) {
              String[] source = new String[] {"C:\\TestData\\APP_Properties.xml","C:\\TestData\\??.txt" };
              byte[] buf = new byte[1024];
              try {
                   // Create the ZIP file
                   String target = "C:\\TestData\\target.zip";
                   ZipOutputStream out = new ZipOutputStream(new FileOutputStream(target));
                   // Compress the files
                   for (int i = 0; i < source.length; i++) {
                        FileInputStream in = new FileInputStream(source);
                        // Add ZIP entry to output stream.
                        String fileName;
                        File tempFile;
                        ZipEntry zipEntry = new ZipEntry(source[i]);
                        fileName = zipEntry.getName();
                        zipEntry = new ZipEntry(fileName);
                        zipEntry.setMethod(ZipEntry.DEFLATED);
                        getUTF8Bytes(source[i]);
                        out.putNextEntry(zipEntry);
                        // Transfer bytes from the file to the ZIP file
                        int len;
                        while ((len = in.read(buf)) > 0) {
                             out.write(buf, 0, len);
                        // Complete the entry
                        out.closeEntry();
                        in.close();
                   // Complete the ZIP file
                   out.close();
              } catch (IOException e) {
                   e.printStackTrace();
         private static byte[] getUTF8Bytes(String s) {
              char[] c = s.toCharArray();
              FileOutputStream file;
              try {
                   file = new FileOutputStream("C:\\TestData\\output.txt", true);
                   int len = c.length;
                   // Count the number of encoded bytes...
                   int count = 0;
                   for (int i = 0; i < len; i++) {
                        int ch = c[i];
                        if (ch <= 0x7f) {
                             count++;
                        } else if (ch <= 0x7ff) {
                             count += 2;
                        } else {
                             count += 3;
                   // Now return the encoded bytes...
                   byte[] b = new byte[count];
                   int off = 0;
                   for (int i = 0; i < len; i++) {
                        int ch = c[i];
                        if (ch <= 0x7f) {
                             b[off++] = (byte) ch;
                             file.write((byte) ch);
                        } else if (ch <= 0x7ff) {
                             b[off++] = (byte) ((ch >> 6) | 0xc0);
                             file.write((byte) ((ch >> 6) | 0xc0));
                             b[off++] = (byte) ((ch & 0x3f) | 0x80);
                             file.write((byte) ((ch & 0x3f) | 0x80));
                        } else {
                             b[off++] = (byte) ((ch >> 12) | 0xe0);
                             file.write((byte) ((ch >> 12) | 0xe0));
                             b[off++] = (byte) (((ch >> 6) & 0x3f) | 0x80);
                             file.write((byte) (((ch >> 6) & 0x3f) | 0x80));
                             b[off++] = (byte) ((ch & 0x3f) | 0x80);
                             file.write((byte) ((ch & 0x3f) | 0x80));
                   file.write((byte) '\n');
                   file.write((byte) '\r');
                   file.flush();
                   file.close();
                   return b;
              } catch (FileNotFoundException e1) {
                   e1.printStackTrace();
              } catch (IOException e1) {
                   e1.printStackTrace();
              return null;
    }Thanks
    Aravind                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to do document offset in Simple Plain to XML for Zip file Sender side

    Hi,
    Scenario is .zip file to IDOC, A idoc per a record. .Zip file has simple Plain structure like below. Tab delimiter.
    Name  number   code   country   Rating  Item
    ABC    123        C4        IND           I2        PRD
    ABD    123        C4        IND           I2        PRD
    ABE    123        C4        IND           I2        PRD
    I am using Adpater Module  and  Header is generating  a IDOC (total 4 IDOCs) in ECC. I would like to use similar to file 'document offset ' option in Adapter Module to skip the header row. so, I need only 3 IDOCS.
    plain2XML and using MsgTransfermationBean.
    I tried with
    xml.documentSkipFirstRows=1
    xml.documentOffset=1
    xml.addHeaderline=0
    I came to know that  above all for STRUCTURAL Plain parameters so no use.
    I checked this http://forums.sdn.sap.com/thread.jspa?threadID=1223739
    http://help.sap.com/saphelp_nw04/helpdata/en/70/f3cbad30ee479cb15672219f3405f0/frameset.htm
    Could you please help me with proper parameter to skip the header/first record of the file.
    Thanks
    shoukat

    Hi Shoukat,
    Try with the following parameter:
    xml.processFieldNames = fromFile
    As of SAP Help: "means that the field name information is located in the header line of the file to be converted."
    Hope this helps,
    Greg

  • Prefer photos compressed in zip file rather than imbedded in email

    My daughter sends me pictures of our granddaughter using her Powerbook, iPhoto, and Apple Mail app. I use AOL for my regular mail. Mail seems to automatically imbed the pictures in the body of the email. If she sends a large number of pictures, even properly resized for email, it takes forever for these files to open in the body of the email. I received an email with 16 pictures and it took nearly ten minutes to open, and AOL kept warning me it was overloaded. Is there any way to use Apple Mail and have the pictures zipped?
    ds

    As I mention in a post to HTML question in this forum, I believe the only thing that distinguishes "embedded" from "attached" images is some tags in the message -- it really doesn't make much sense to talk about them as separate files until something processes them into such after receiving what is really a single transmitted message.
    IOW, Mail (& every other MIME-compliant sender app) always sends the pictures in the email itself, so it is a question of which tags it uses with them & how processes use them that determines what you see at the receiving end. Ideally, the only processing occurs at the receiving end, but in reality the servers may apply processes before final transmission to the addressee. For example, many free email services insert promotional ad blurbs into the body of the message. A few, particularly AOL, can strip the non-text content off the message as a parental control feature or at the request of client software & deliver (or not deliver) it as individual files, sometimes substantially altering the content or encoding as yet another "feature" of the service.
    Long time AOL users may have noticed such things in the pre-OS X days -- if you sent multiple attachments via the old AOL client, it would automatically convert them to a .sit file for uploading & (in theory at least) AOL would automatically serve them as .sit files to Mac clients & .zip files to PC clients. (What David S. sees now with the OS X AOL client is the equivalent of that, less the conversion between .zip & .sit.) Using the AOL client also used to -- & maybe still does -- change some file associations so that the "owner app" (the default app that opens the file) is the AOL client.
    If you have the Mac AOL client installed, you may notice that it is on the list of "open with" apps for many, many file types. Ironically, it is happy to open & play System 7 sound files & will become the default for opening them since OS X doesn't by default provide any app that registers with launch services to do this. Similar things happen with other file types, particularly those that are common with PC's but less so with Macs, or are basically proprietary versions of compression formats licensed by the once-mighty AOL & still floating around the web because their use is as free as all those AOL client disks it was once impossible to avoid. (For example, if you occasionally want to compress files into .sit format & don't feel like paying for Stuffit, you can do so with the AOL client.)
    Anyway, the point is once you involve the AOL client in the equation, you can no longer be sure what you send is what a recipient will receive, over & above whatever the client email app does to process the message, or anything else that occurs after a message is sent.
    In my experience, the best approach for images or anything else you want to arrive unaltered is to first "encapsulate" every file into a single zip file with the Finder (actually BOMArchiveHelper, if you want to be technical about it), & then attach that to your email. This pretty much keeps services from mucking with it in any way: even if they split it out from the text of the message, they treat it as one, non-graphic file that can't be displayed inline, no matter what the tags or anything else say they can do with it.

  • Opening a Pages document in Pages format results in a zip file

    Trying to print a Pages document from my iPad to a non-Airprint printer.  Want use HP's ePrint app.   Bring up "open in another app" -- and then I am asked to chose a format.  Chose Pages.  Then asked for an app.  Chose ePrint.  ePrint locates my non-Airprint printer, but cannot print.  Reason: the Pages document has tuned into a zip file (xxxxxx.pages.zip).   Why??   If I chose Word format, the Pages document becomes a docx file, and it CAN be printed by ePrint.  I do not understand what is happening here.  I also get a zip file if I try to use Dropbox.

    Well, to your curiosity once more, read that link I sent you again - this part in particular:
    While the Finder did not treat this file as a package (that is, no Show Package Contents command showed up in the document’s contextual menu), it was indeed a package. To pry it open, you could use a utility such as Pacifist. Inside, you’d find several items, most notably an index.xml file which contained the primary content you created.

  • In a hurry, I opened an email that said "order was shipped from "ammazon". I downloaded the order document and it ended up being a zip file. I then realized what it was, and did not actually open the file. This was on my Iphone 5. What should I do now!?

    In a hurry, I opened an email that said "order was shipped from "ammazon". I downloaded the order document and it ended up being a zip file. I then realized what it was, and did not actually open the file. This was on my Iphone 5. What should I do now!?

    Delete the email. The zip file will have no effect on your iPhone.

Maybe you are looking for

  • No audible notifications when bluetooth connected to car

    Hello I have a 2013 Hyundai Elantra and a iPhone 5 running iOS 7.  When my phone is connected via Bluetooth and I'm listening to fm or xm radio my phone automatically places my text and email notifications to vibrate.  Please help.

  • IPad Calendar doesn't sync back to iCloud nor Mac

    Hello all, I have a strange issue that, since a few days, the iPad-based, iCloud-linked calendar doesn't sync back to iCloud. Hence, for that reason, the calendar on the Mac isn't in sync, and this is, as you can guess, pretty annoying. iPad runs iPh

  • Just downloaded aperture 3.  Wont open because i dont have iPhoto.  why?

    Do I really need iphoto for aperture 3 to run?? I just upgraded to mountain lion, didn't ever think i needed the newest iphoto...

  • CommSuite and Solaris 11

    Hello all, The CommSuite Wiki states that "Solaris 11 is not supported" at this time. However there are a number of "tasty" features such as VNICs, new ZFS features, etc., that a messaging deployment would benefit from. Short question is: does CommSu

  • Sql developer - not able to establish connection

    I have installed sql developer 3.2.2 and now I am trying to establish a connection with the database 'orcl' which I just created. But it is giving me a 'socket read timed out error' with vendor code 504. Please help. Thanks in advance.