Unzip File bevor Polling

Hello
A Zip file contains some XML file. It's possible to unzip the file and then polling each XML file. If its possible how this szenario must be build. Till yet the szenario works with the n-XML files and I want to enhance it with zip.
Thx
Regars
Ofer

Hi Ofer,
OS script is the best thing, we have some other alternatives also
By using the Java or ABAP mapping we can send the data
/people/aayush.dubey2/blog/2007/10/10/zip-transfer-unzip-increase-the-performance-of-your-java-abap-applications
By using Bean
/people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
Regards
Ramesh

Similar Messages

  • Unzip files from a folder which is updating regularly using multithreading

    Hi All,
    I have acode which unzip all the files from a folder .This code picks up all the zipped files at a time and then unzip it and write them to another folder but now my requirement is changed ,suppose the source folder where all the zipped files are present is refreshed or updated with new zipped files regularly then how can I implement in my code multithreading to get several files by threads and send it for unzipping.
    Please suggest with some example or edit my code.
    package com.myprojcet;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    public class Main {
         * Extracts a zip file
         public void extractZipFile() {
              try {
                   String zipFileName = "C:\\soft\\test"; //Source folder for zipped files
                   //Create input and output streams
                   File SourceDir = new File(zipFileName);
                   File[] zipFiles = SourceDir.listFiles();
                   ZipInputStream inStream = null;
                   OutputStream outStream = null;
                   ZipEntry entry;
                   byte[] buffer = new byte[1024];
                   int nrBytesRead;
                   //Get next zip entry and start reading data
              for(int i=0; i < zipFiles.length; i++) {
                   inStream= new ZipInputStream(new FileInputStream(zipFiles));
                   while((entry = inStream.getNextEntry()) != null) {
                        outStream=new FileOutputStream("C:\\soft\\test2\\"+entry.toString()); //destination folder for unzipped file
                        while ((nrBytesRead = inStream.read(buffer)) > 0) {     
                             outStream.write(buffer, 0, nrBytesRead);
                   //Finish off by closing the streams
                   outStream.close();
                   inStream.close();
              } catch (IOException ex) {
                   ex.printStackTrace();
         * @param args the command line arguments
         public static void main(String[] args) {
              new Main().extractZipFile();
    Thanks
    Sumit
    Edited by: user8687839 on Feb 27, 2012 11:00 PM

    But my question is that if in a source folder we have several files which are in zipped format and the folder is getting updated every min (say) with new zipped files (which are dumped from some outside environment).I need to unzip all the files present in the folder ,if new one comes there then also check for the new zipped file and unzip it.You don't need to keep re-stating that.
    I had written a code for unzipping a file from a folder (thinking the folder is not updated everytime).Or that.
    Now I am thinking of using threads because if I create suppose 5 threads and every threads poll the source folder and pick up a zip file ,send it for unzipping it and again poll the source folder for any new entries?Or that.
    If using the threads here hits performace then what should I use?Err, what you presently have?
    Provide me any sample code or link that would be more useful.You've already written it.

  • Unzip files from SDCARD

    HI,
    i am trying to unzipping files from external sdcard..
    i am using zipme.jar, but when i am deploying this application it give error.
    please nay one hep me to unzipping files using 3rd-party jar

    But my question is that if in a source folder we have several files which are in zipped format and the folder is getting updated every min (say) with new zipped files (which are dumped from some outside environment).I need to unzip all the files present in the folder ,if new one comes there then also check for the new zipped file and unzip it.You don't need to keep re-stating that.
    I had written a code for unzipping a file from a folder (thinking the folder is not updated everytime).Or that.
    Now I am thinking of using threads because if I create suppose 5 threads and every threads poll the source folder and pick up a zip file ,send it for unzipping it and again poll the source folder for any new entries?Or that.
    If using the threads here hits performace then what should I use?Err, what you presently have?
    Provide me any sample code or link that would be more useful.You've already written it.

  • Unzipping Files in the wrong folder

    Hi
    I am trying to unzip files. It works fine except that it unzips the files at the root. So i have tried specifying the path for making the directory (in which the unzipped files are stored). But that doesnt seem to work. Now i am unable to find the unzipped files. CAN ANYONE HELP PLEASE
    public static void unzipFile(String zFile)
            Enumeration entries;
            ZipFile zipFile;
           try {
                zipFile = new ZipFile(zFile);
                File file = new File(zipFile.getName());
                String fname = file.getName();
               String substr1 = fname.substring(0, fname.indexOf("."));
                String filepath = "/data/psawant/temp";
                File dir = new File(filepath, substr1);
                try {
                        dir.mkdir();
                catch (Exception fe)
                      System.err.println("Unhandled exception:");
                        fe.printStackTrace();
                        return;
                entries = zipFile.entries();
                while(entries.hasMoreElements()) {
                    ZipEntry entry = (ZipEntry)entries.nextElement();
                    if(entry.isDirectory())
                         // Assume directories are stored parents first then children.
                        System.err.println("Extracting directory: " + entry.getName());
                                          (new File(entry.getName())).mkdir();
                        continue;
                    } //end of if
                    System.err.println("Extracting file: " + entry.getName());
                    copyInputStream(zipFile.getInputStream(entry),
                        new BufferedOutputStream(new FileOutputStream(entry.getName())));
                 } //end of while
                zipFile.close();
                   } catch (IOException ioe)  {                 }
             } //end of unzip function
    public static final void copyInputStream(InputStream in, OutputStream out)
        throws IOException
            byte[] buffer = new byte[1024];
            int len;
            while((len = in.read(buffer)) >= 0)
            out.write(buffer, 0, len);
            in.close();
            out.close();
    Any help is apprciated
    Thanx

    Sorry I got it this time. I had overlooked the new File. I added that & it works fine but there seems to be some problem
    If the folder has another folder inside . it doesnt show that one. or rather just unzips one folder & no folders inside it. But i guess i can check for that
    Thanx for u r help
    Have a nice day

  • UNZIP file from ABAP

    Hi,
    I have a requirement to retrieve a zip file from the FTP Server, unzip it to the SAP Server and process the unzipped files. Retrieving the data from the FTP server should work via FTP commands which can be executed from within an ABAP program. However, the problem is unzipping these files via ABAP and put them on the server as well. 1. How to do this from within an ABAP Program? (unix commands?)
    2. Can I unzip these files with or without using the folder structure? (additional parameter for unix command?)
    Kind regards,
    Micky.

    REPORT ZTESTUNIX line-size 400
                    no standard page heading.
    selection-screen begin of block ucmd with frame title text-001.
    parameters: unixcom like   rlgrap-filename.   " ...SAP Interface file
    selection-screen end of block ucmd.
    data: begin of tabl occurs 500,
            line(400),
          end of tabl.
    data: lines type i.
    start-of-selection.
      refresh tabl.
      call 'SYSTEM' id 'COMMAND' field unixcom
                    id 'TAB'     field tabl[].
      describe table tabl lines lines.
      loop at tabl.
        write:/01 tabl-line.
      endloop.
      skip 2.
      if lines = 0.
        write:/ 'NO Occurances were found'.
      else.
        write:/ 'Command was successfully executed' color col_total.
        write:/ 'Number of entries in Search' color col_total,
                 lines color 6.
      endif.
    end-of-selection.
    while running give the command as
    <b>unzip test.zip  -x dir</b>
    then it will unzip test.zip file to dir called dir.
    you can specify the filepath instead of file...
    regards
    vijay

  • File Adapter polls all the files from the directory when deployed again

    Hi,
    File Adapter polls all the files from the inbound directory irrespective of the timestamp when deployed again.
    For ex. when the BPEL process with file adapter is deployed, it starts polling the directory based on the timestamp as and when the directory is written with the files. I did not opt for deleting the files after read by the File Adapter.
    But, when BPEL process is modified and deployed again, this time, the file adapter picks up all the files in the inbound directory and doesn't consider the timestamp.
    My guess is that it should not pick all the files but based on timestamp only.
    I guess I can observe the same behavior if I bounce the Application Server also
    Do I have an option to achieve this?
    Thanks,
    Sasi Bhushan.

    try this:
    1- create a File object for the directory. (look at isDirectory() )
    2- create a File[] that represents the files in that directory. (.listFiles())
    3- if (file[x].isDirectory()) {recursive method call;}
    4- else {
    process file;
    If you want more help--do some work on it, and come back with specific questions relating to specific lines in your code and specific error messages you've been receiving.

  • File adapter polling frequency is not consistent in SOA 10g!

    Friends,
    I have used file adapter for polling files in a service in SOA 10G env. with polling frequency 3600 secs. However, i have noticed file polling is not happening at 60 mins interval, instead some times files getting polled in less than 30 mins but again after sometime its polling correctly in 60 mins interval. I am not sure what could be the reason but i need a solution urgently. Please help!

    Could be the managed servers in the cluster are not in sync.
    I faced DB JCA adapter sync issues because of Oracle soa suite bug.
    You could check whether any sync issues are there with File adapters.

  • Unable to unzip files , unable to move apps into the app foldercant update

    I cannot unzip files. Also if i try to install a new app by dragging it to the applications folder it says "that files already exists".
    also if i try to update with software update it gives an error. i tried running verify disk permissions and repair disk permissions but this did nothing please help i am scared cuz my last time machine was along time ago.

    Not to worry.
    A few clarification questions first.
    What exactly does the dialog say when you try to drag a new app to the applications folder? Is it something like, "an older version of this already exists in this location, do you want to replace it with the version you are moving?"
    And, what application are you attempting to use to unzip files?

  • Problem with unzipping file

    I am trying to unzip a file using java.util.zip. It is throwing a ZipException in the first line where I instantiate ZipFile object.
    ZipFile oFile = new ZipFile("/myzip.zip");java.util.jar is not working either. It fails right here:
    JarFile oFile = new JarFile("/myzip.zip");Here is the exception thrown in the above cases:
    java.util.zip.ZipException: error in opening zip file
            at java.util.zip.ZipFile.open(Native Method)
            at java.util.zip.ZipFile.<init>(Unknown Source)
            at java.util.jar.JarFile.<init>(Unknown Source)
            at java.util.jar.JarFile.<init>(Unknown Source)
            at ReadZipFile.main(ReadZipFile.java:21)
    An interesting observation:
    I am able to extract the contents of the zip from the command-line using jar utility.
    jar xvf myzip.zipI am stumped! I think jar utility internally uses the same classes for unzipping files. How come it is working with jar utility whereas it is not working from Java program? Also, the myzip.zip appears to be a valid archive - I am able to open it with winzip.
    Any pointers will be appreciated.
    Thanks in advance,
    Ganesh

    I think the above reply is correct but didn't explain why you would be getting a file not found. Unless you have your zip file at the root of your harddrive the slash in the filename is improper. Without the slash your code will assume your current working directory and look for the file there.
    By putting that forward slash in there you are telling the code to look at the root of the filestructure and NOT at the current working directory.

  • File adapter, trigger if no file is polled for pre-defined time

    Hi',
    I am polling for a file in a directory, my requirement is to notify by a email
    if no file is polled for 1 hour or so, i.e. if no file comes in that directory for
    long time.
    Is there a way we can achieve this, I tried using a pick activity instead of
    receive, however it does not allow on-alarm in this condition.
    Please advice.
    Thanks
    Yatan

    If you dont want to use database then you can do with your files as well, if at all you are archieving the files.
    Say as soon as i get the files in the folder the adapter will read its content and then move it to archive folder, then you can have a logic to list the file and get the timestamp of the latest file from archive and compare with current time stamp and that will trigger a mail.
    You can achive the above using API.
    Thanks,
    Vijay

  • Unzip file from froms then load

    i have form (basically called loader) which read text file and then load it in data base.
    Now,there is a user requirement that if text file is in zip format then he can unzip file using form.
    Any idea how to do this can some unzip software used at back end.
    I mean any idea any suggestion is required.
    Forms 6i i am using.

    The zip.exe and unzip.exe are shipped with Oracle products, they are found under %ORACLE_HOME%/bin
    just type zip or unzip in a command line session and you'll get all the switches and details.
    Judging from your first post I understand you are running in C/S mode, if not you need to use CLIENT_HOST from webutil instead of HOST. It's the same concept.
    As for HOST built-in example, I told you, there are very nice and detailed examples in the online help of Forms builder.
    Open Forms builder and either press Ctrl + H or click on the big blue question mark, or open help menu and click on "Online Help".
    Tony
    Message was edited by:
    Tony Garabedian

  • Unzip files from FTP using  ABAP

    Hi All,
    I have the a requirement to unzip certain files from ftp and transfer the extracted files to another directory in ftp.
    Searched  (Re: Unzip file;)  in SDN but didnt find the perfect solution
    Appreciate the help.
    Regards
    Siva

    You can use IndexOf function
    see this example
    http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Execute Process Task error-Unzip Files

    Dear All,
       I have a SSIS package, that downloads a Zip file from FTP Server and extract and load that information in Sql Server Table. In my case every time I have only one file in FTP Server. There is no possible to get multiple files from FTP Server.
    While at the time of executing SSIS package getting error at Execute Process Task(Unzip Files) i.e 
    Error Description :In Executing "F:\7z\7z.exe" " x F:\ZipFiles\Sales_010815.zip -oF:\ZipFiles\" at "", The process exit code was "2" while the expected was "0".
    This error message getting while unzip my file. 
    Can some one help on this issue.
    Regards,
    Praveen C.
    Regards, Praveen

    Hi Praveen,
    After testing the issue in my environment, I find the issue is caused by the code in Arguments is incorrect.
    To fix this issue, please refer to the code below:
    x F:\ZipFiles\Sales_010815.zip -oF:\ZipFiles
    The following screenshot is for your reference:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Powershell to unzip file having passowrd

    hi, i am using the following script to unzip files it works fine with files not having password
    $shell=new-object -com shell.application
    $CurrentLocation=get-location
    $CurrentPath=$CurrentLocation.path
    $Location=$shell.namespace($CurrentPath)
    $ZipFiles = get-childitem *.zip
    $ZipFiles.count | out-default
    foreach ($ZipFile in $ZipFiles)
    $ZipFile.fullname | out-default
    $ZipFolder = $shell.namespace($ZipFile.fullname)
    $Location.Copyhere($ZipFolder.items())
    # for password protected file it pops up a windows saying password needed, how can i enter the password in script
    #what changes i need to make if i have to extract password protected files.
    student

    AFAIK, you can't do passwords directly with WScript.  You may be able to code up a method to imitate key strokes though.
    My suggestion would be to call another command-line utility zip/unzip program like 7-zip:
    http://www.7-zip.org/download.html

  • Unzip files

    Can someone please tell me if there is an easy way to unzip files with the hardware/software that comes with an Apple OSX SnowLeopard?  If so, I would appreciate very simple step by step instructions as to how to do this as I am fairly ignorant about the Mac systems.  I've used PC's for years and this Mac is new to me.  Thanks very much for any help.
    Respectfully
    Jim

    You mean that's all there is to it?
    Wow, that was easy enough. Thanks a million Neil I sure appreciate the help.
    Jim

Maybe you are looking for