How to ZIP the files and folders/sub folder files using java

HI All,
I'm New to this Forum, Could anybody tell me how to zip the files and folders/sub folders using java. For example I have a folder with the name testfolder and side that folder I have some files and some sub folders inside subfolders I have some other files. I need to ZIP the files and folders as they are in same hierarchy.
Any pointers or help wolud be appritiated.
Thanks,
Rajeshbabu V

[http://www.devx.com/tips/Tip/14049]

Similar Messages

  • Code for reading the and placing the file using java webservice

    Hi All,
    Can anybody can guide me on how to read a file and place the file using java.
    Let  me know if any code is available which has been completed using java.
    Regards,
    Rahul

    Hi,
    The "square" symbol that you are referring to is probably a CRLF (Carriage Return - Life Feed) Control Character.
    This is more commonly known as a "Enter" at the end of a line / sentence.
    To clean this character from strings in Java, please use:
    String patternStr = "(?m)$^|[\\r\\n]+\\z";
    String replaceStr = " ";
    Pattern pattern = Pattern.compile(patternStr);
    Matcher matcher = pattern.matcher(inputStr);
    return matcher.replaceAll(replaceStr);
    Hope that helps.
    Thanks.
    p256960.

  • How to create a table in the file using java code.?

    HI,
    I should export the data from the view objects to a word document. I have done that but I should
    display the data in the form of a table.
    Kindly come up with the necessary information on how to create a table in the file using java.
    Thanks,
    Phani

    Hi, Thank you for responding to my query.
    The below are the details of my code.
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding StudentDetailsContent =
    (DCIteratorBinding)dcBindings.get("StudentView1Iterator");
    OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
    Row currentRow =
    StudentDetailsContent.getRowSetIterator().first();
    Object a[]= currentRow.getAttributeValues();
    int i;
    for(i=0 ;i<=a.length;i++){
    w.write(a.toString());
    w.write(" ");
    w.flush();
    I am usning this coding to achieve the task of exporting data to file.
    I need to display this information in the table that is where I need help from you people.
    Thanks,

  • How to print PDF files using java print API

    Hi,
    I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api.
    Thanks in advance

    Mike,
    Can't seem to get hold of the example described in your reply below. If you could let us have the URL to get then it would be great.
    My GUI application creates a pdf document which I need to print. I want to achieve this using the standard Java class PrinterJob (no 3rd party APIs I'm afraid, commercial restraints etc ..). I had a stab at it using the following code. When executed I get the pretty printer dialog then when I click ok to print, nothing happens!
    boolean showPrintDialog=true;
    PrinterJob printJob = PrinterJob.getPrinterJob ();
    printJob.setJobName ("Contract.pdf");
    try {
    if (showPrintDialog) {
    if (printJob.printDialog()) {
    printJob.print();
    else
    printJob.print ();
    } catch (Exception PrintException) {
                   PrintException.printStackTrace();
    Thank you and a happy new year.
    Cheers,
    Chris

  • How to run .jar on linux & how to create .jar file using java?

    hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
    thanks in advance.

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • How to open/read file using Java in Unix?

    Hi Friends,
    Can you please help me out how to open/read file using java in unix os? I have create one text file in "/home/test.txt" in unix environment. How to open the same file & read using java code?
    - Hiren Modi

    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • How to Zip Excel files using File Adapter?

    Hi,
    We have tried to ZIP the Excel file with  PayloadZipBean in File adapter. But we faced some issue while zipping.
    We have seen some zunk data in excel file after zipping with PayloadZipBean. Someone please help how to zip Excel files in PI with File Adapter.
    Regards,
    Sreeramulu Konjeti.

    Hi Sree,
    If you are facing any issue with PayloadZipBean then you can use java mapping to Zip the files.
    Please find the complete Java mapping code to zipt the file
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50ce0433-4309-2b10-4bb4-d421e78463f7?quicklink=index&overridelayout=true

  • How to change the name and description of a wim using DISM

    With Imagex we could update the name and description of the wim with on easy command:
    imagex /info img_file [img_number or
    img_name] [new_name] [new_desc]
    e.g.
    imagex /info Win7Combined.WIM 1 "Win7(x86)" "Windows 7 x86"
    Since the ImageX tool is deprecated in Windows 8 and has been replaced with DISM, can someone explain how to update the name and description with one easy command using DISM like we could with Imagex?

    It looks like this person had the same issue. Have you seen this
    link
    It talks about exporting an Index into a new WIM. Which, in a way, would be renaming it. It's really recreating it and you have to give it a name. But it seems to work.
    Dustin Estes - MCP | www.dustinestes.com

  • How to view the file using the content

    Hi all,
    I have uploaded the data from a binary file to an internal table using GUI_UPLOAD.
    Could you please suggest any way how i can view the file using the content.
    The binary content looks as follows.
    345DCC27F35A291DFD5496E0609E8ED08F3405AF5FE3DDC574166CDE0D79B7A174BC6
    D87597FA824B3E56E82E451D4C2B4D32A423279A668BB6690C7E9956E90CFE766CB37
    39E70D650300006D08000011000000776F72642F73657474696E67732E786D6C9C56D
    69B6197B7F5BDD4C58841ECC06943522630781EC71767DF5504F0B6B3C4674DEE0D46
    Thanks,
    Vishnu

    Hi all,
    Thanks a lot for the reply.
    Here, my requirement is to open the content as a file.
    I have used 'GUI_UPLOAD' FM to upload the contents & need the same file(PDF, JPG, DOC etc) to be displayed using the content.
    Eg., If i upload an Image using the FM 'GUI_UPLOAD', based on the contents & extention can i see an image?
    Please help me in the regard,
    Thanks,
    Vishnu

  • How to read pdf files using java.io package classes

    Dear All,
    I have a certain requirement that i should read and write PDF files at runtime. With normal java file IO reading is not working. Can any one suggest me how to proceed probably with sample code block
    Thanks in advance.

    hi I also have the pbm. to read pdf file using JAVA
    can any body help meWhy is it so difficult to read the thread you posted in? They say: java.io is pointless, use iText. So why don't you?
    or also I want to read a binary encoded data into
    ascii,
    can anybody give me a hint how to do it.Depends on what you mean with "binary encoding". ASCII's binary encoding, too, basically.

  • How to gzip a file using java

    Friends,
    I want to gzip a file in unix using my java program, can I use Runtime.exec() method and run the gzip command to achieve this ?
    Is there any other way to zip/compress a file using java api ?
    Thanks

    Use [url http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/GZIPOutputStream.html]java.util.zip.GZIPOutputStream along with [url http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileOutputStream.html]java.io.FileOutputStream

  • How to load avi files using java ?

    Hi, i need to load avi (movie file) using java. I have usually done with java applet, but the applet just can load image (jpeg, gif)

    All types of data should be downloaded in same way. What is your problem: exception or something else? Post here.

  • How to get the file using file adapter.

    Hi All,
    We have a requirement, IDoc -> PI -> JMS Adapter. Here the IDoc is in Flat file format. How can i consume Flat file version of IDoc into PI using Sender File Adapter for further processing..
    The Flat file version is been created within the SAP Application server "/usr/sap/SID/SYS/global"
    Do I need to specific Source Directory as "/usr/sap/SID/SYS/global" in Sender comm channel? How about the remaining parameters like authentication details?
    plz guide me..
    Thnx

    Check the below link:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0901cba-f49e-2910-748c-d7ce4c0c4c1c?quicklink=index&overridelayout=true
    go to transaction AL11 and there you can find DIR_HOME with a path.
    D:usrsapPID..
    Double click on the filename, you would be able to view the file content.
    That path is ur Application Server path, there you can save your file. Then in the External Data tab in Scheduling screen select Application server and on the file name press F4 so u can get the AL11 files select that then double click DIR_HOME, select your file.
    It will ask for display contents or copy name. Give COPY NAME the file name with path will be copied.
    If we are using Sender File Adapter to consume the file then what should be the source directory (i.e., /usr/SAP/PID/Global/..)
    If you are on the same network then use File Aapter(NFS).
    Now, the path should be usrSAPPIDGlobal

  • How to zip multiple files using plsql

    Hi All,
    I have created a group of files using utl_file and stored in a specific directory.
    I want to zip them all so that i can send it throug email.
    Could you please help me to write a pl sql program which can do the above.
    Thanks
    Kiran

    Hello Kiran,
    you posted this question before {thread:id=2248112} and got some answers. Did you follow the links? If you have still questions then please use the original thread.
    Regards
    Marcus

  • Hi, How to unzip the file in java.........urgent........plz.......!

    Hi Friends,
    I'm new to Java. I have problem in java.uitl.zip.*; api. I want zip the set of files into .zip and unzip the zip file. it is successfully working in my pc. i want unzip this zip into another system which is conncted to lan.
    it raise exception like Context file path exception and unzip exception.
    plz help me for this problem.

    all4u wrote:
    I need this solution urgently... plz... help me.......Oh it's urgent. Well why didn't you tell us that in the first place?
    Well no worries just stand by and I shall mind-meld to your IDE, spot your problem and post your fixed codes shortly. Just please be very patient and quiet because if you post again it could throw the mind-meld into disarray and make me post code for a JDBC connection error rather than your zip problem and nobody wants that.

Maybe you are looking for

  • Need a sample SSRS report with 3 groupings

    Where might I find a sample report with 3 groups that I could just download and modify for my purposes. I cannot get this to work right. I don't want any detail lines to show until all 3 groups have been chosen. Of course I'd like to learn how to do

  • PROBLEM IN PUBLISHING

    I made a simple tween animation, where in the texts will scroll left to right, up down and alpha from 0 to 100 vice versa in the editor, ut was working fine, all animations are ok, until i publish them, animations are not working, tween animations al

  • Air drop don't work on 4 yr old macbook pro's

    I just downloaded Lion on my 4 yr old macbook pro and air drop is one of the features that wont work because my mac is to old in the computer world. I am trying to now find out what else am I gonna not get out of this and why didnt they say that kind

  • Account determination for entry 1000 AUM

    Hello Everybody, While doing the stock transfer (MB1B) from unrestricted stock to sales order stock  system is giving the below error. "Account determination for entry 1000 AUM 1000 ___ 3100 not possible     Message no. M8147 Diagnosis     The system

  • Print webpages as they appear on screen ?

    Hi, I have a MacBook running Lion with Safari 5.1 and printer HP B110. When I print a webpage the format is completely different than the way it appears on screen. I never had much reason to print webpages until today so I do not know if this is norm