Reading and processing file(s) in a filesystem

I'm fairly new to java programming and need help.
I need to write code which will and read and process 1 or many files from a filesystem. If a file is found, read and process it. Then do same for all files found.
Please help.
Thanks in advance!

Some classes of the package java.io will be used .
http://java.sun.com/j2se/1.4.1/docs/api/java/io/package-tree.html
(The java.io.File has the methods list() and listFiles(), of which the former returns an array String[] and the latter returns an array java.io.File[]. )

Similar Messages

  • Programmatically reading and processing a spool file

    Hello,
    I would like to read and process a spool file generated by a background job in my ABAP program.
    Can anyone advise if this is possible in SAP and if so, the best way to do this?
    The only information I will have in my program is the job name and the date on which the job was run. I then need to find the corresponding spool and read this into an internal table.
    Any ideas on how to do this would be appreciated.
    Thanks,
    Ruby

    DATA : it_spool      TYPE STANDARD TABLE OF rsporq    .
    *&      Form  find_spool_request_id
    FORM find_spool_request_id.
      CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
        EXPORTING
          allclients          = '320'
          datatype            = '*'
          has_output_requests = '*'
          rq0name             = nast-dsnam
          rq1name             = '*'
          rq2name             = '*'
          rqdest              = 'LOCL'
          rqowner             = sy-uname
        TABLES
          spoolrequests       = it_spool
        EXCEPTIONS
          no_permission       = 1
          OTHERS              = 2.
      IF sy-subrc <> 0.
        MESSAGE i000 DISPLAY LIKE 'E' WITH text-002.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " find_spool_request_id
    READ TABLE it_spool INTO wa_spool INDEX 1.
      v_spoolno = wa_spool-rqident.
    *Get Spool request attributes
      SELECT SINGLE *
        FROM tsp01
        INTO tsp01
        WHERE rqident EQ v_spoolno.
    Edited by: K.Manas on Jan 7, 2011 6:22 AM

  • How to read and process oData service's ATOM XML output?

    Hi,
    I have a RFC created in system A which will call oData services of system B. I am calling this in a report using class methods,  cl_http_client. I will get the response in a ATOM XML format. Is there a standard way to read and process such ATOM XML in abap report without using further addons?
    Regards,
    Vinay

    You need to pass your filename String as a parameter to your functionality. It depends how you're currently set up though. We can't really see the top of your call so it's difficult to determine what you are calling and we don't really know from where you're calling either.
    If you're running standalone, then on launch of the application, you can feed in a file name as an argument that you can read in in String args[] in the main function and pass down to your XML splitter.
    If you're a method in a class that's part of a bigger pile, you can feed the file name as a String to the method from wherever you call from if it makes sense architecturally.
    You might also want to pass down a File object if that makes sense in your current code (i.e. if you're using your file for other purposes prior to the split, to avoid recreating closing/opening for no reason).
    Depends what you're trying to do. If I put together a piece like this, I would probably create an <yourcurrentrootpackage>.xml.splitter package.
    Also, on a side note, you're problem isn't really reading and writing XML in java, but seems more to be making your functionality generic so that any XML file can be split with your code.
    Regards
    JFM

  • Why is it when i download the software update for iphone an error pops out when downloading is finish and processing file is being done...i've already tried several time but still the same result.

    why is it when i download the software update for iphone an error pops out when downloading is finish and processing file is being done...i've already tried several time but still the same result.

    Disasble the computer's security software during the download and update.

  • Very high log file sequential read and control file sequential read waits?

    I have a 10.2.0.4 database and have 5 streams capture processes running to replicate data to another database. However I am seeing very high
    log file sequential read and control file sequential read by the capture procesess. This is causing slowness in the database as the databass is wasting so much time on these wait events. From AWR report
    Elapsed: 20.12 (mins)
    DB Time: 67.04 (mins)
    and From top 5 wait events
    Event Waits Time(s) Avg Wait(ms) % Total Call Time Wait Class
    CPU time 1,712 42.6
    log file sequential read 99,909 683 7 17.0 System I/O
    log file sync 49,702 426 9 10.6 Commit
    control file sequential read262,625 384 1 9.6 System I/O
    db file sequential read 41,528 378 9 9.4 User I/O
    Oracle support hasn't been of much help, other than wasting my 10 days and telling me to try this and try that.
    Do you have streams running in your environment, are you experiencing this wait. Have you done anything to resolve these waits..
    Thanks

    Welcome to the forums.
    There is insufficient information in what you have posted to know that your analysis of the situation is correct or anything about your Streams environment.
    We don't know what you are replicating. Not size, not volume, not type of capture, not rules, etc.
    We don't know the distance over which it is being replicated ... 10 ft. or 10 light years.
    We don't have any AWR or ASH data to look at.
    etc. etc. etc. If this is what you provided Oracle Support it is no wonder they were unable to help you.
    To diagnose this problem, if one exists, requires someone on-site or with a very substantial body of data which you have not provided. The first step is to fill in the answers to all of the obvious first level questions. Then we will likely come back with a second level of questioning.
    But when you do ... do not post here. Your questions are not "Database General" they are specific to Streams and there is a Streams forum specifically for them.
    Thank you.

  • Problem of long loading and processing file in outlook 2010 of domain user

    Dear all,
    I have a problem on long loading and processing file when every open outlook 2010
    This problem occur when I join my computer to domain (window server 2008 r2) and set outlook of domain user to use shared .pst file, owner by administrator of that computer. Every time when log in to domain user and I open the outlook, it will take very
    long time to loading and processing the file, moreover it always ask password of the email I have set. However, when I finish input password and it is finish send/receive the email, the program work normally.
    I also try with another user account which is the administrator of that computer, the program run very fast and work normally.
    I am not sure the problem is caused from, or is it the wrong way to share .pst file with another user? Any suggestions please give to me.
    Thanks in advance.

    Hello,
    You should ask in one of the following forums, depending on your version of Microsoft Exchange:
    Exchange Server 2013 - Outlook, OWA, POP, and IMAP Clients
    Exchange Previous Versions - Outlook, OWA, POP, and IMAP Clients
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • When will Apple have a searchable text reader and upload file capability?

    When will Apple have a searchable text reader and upload file capability? I have a large text file I need to upload to my iPhone, search, and dial.
    Anything planned?

    I had a Palm the I used for work and travel it had a very nice application called DOCUMENTS TO GO. It allowed you to upload, view, and edit .doc, .xls, and .ppt files. this was very handy when traveling. Also, I could sync my palm with my iMac and work PC using bluetooth, took care of the file transfers as well. I would like to have the same capability on my iPhone. I bought it to replace all of my old stuff i need it to the same as my old stuff. I hope that Apple reads this and gets on the ball. Until then I still have to carry my Palm or thumb drive on trips.

  • Grant an account rights to read and modify files in all Redirected Documents folders?

    We have set up redirected Documents folder with the default recommended permissions that does not grant Administrators any access to the folders.  If an administrator needs access to a folder, they take ownership of the folder, grants themselves permissions
    and does whatever they need to do with the folder such as delete it or give access to a new person.  This is rarely needed so it is not a big deal.
    However,  we  now need to import everyone's Outlook PSTs (stored in their redirected MyDoc's so they are backed up) into their new  Exchange Archive mailboxes.  We will also need to be able to verify all PSTs are gone from the file server
    once the contents are imported into their archive mailbox.  We also need to be able to run reports showing which users are storing music and video files in their folders and how much.
    When I tried to run Windirstat against the share containing the redirected MyDocs folders to see what file types where taking up space, I got very incomplete results even with using psexec running as system account due to inadequate permissions on the user's
    folders.  
    We also need  the PST Capture Tool to have rights to read into their documents folders and move any psts found into the users archive mailbox.
    Rather than having to go to each user's redirected documents fiolder one by one and take ownership to change permissions, is there a more efficient way to have an account running the PST Capture Tool and WindirStat have access to read and change files in
    the user's redirected documents folders?
    I thought of just removing the option in the GPO that says "Grant the user exclusive rights to My Documents," but I don't think that will work on pre-existing
    folders that already have permissions set.

    Hi,
    Based on my research, if you already have a bunch of existing redirected My Documents folders set up with the
    Grant the user exclusive rights to My Documents check box selected, the only documented way to regain access to the folders is to take ownership of each individual folder and manually edit the permissions to give the Administrators group full
    control.
    We can use powershell script to help regain access to the folders, for more details, please go through the below link:
    http://mypkb.wordpress.com/2008/12/29/how-to-restore-administrators-access-to-redirected-my-documents-folder/
    Regards,
    Yan Li
    Regards, Yan Li

  • Read and Process Microsoft Word's Form

    Hi,
    Is there any WDP API or open source Java API to read and process Ms Word's Form, such as input field, pull down list etc.? I know of POI's HWPF, but it can only do some basic Word processing.
    Thanks.
    - julius

    JAWIN or NEWJAWIN!!!!
    newjawin consists of a java-com-codegenerator, which generates Java-Proxy-classes for COM-components like MS Word, Excel, ...
    1. download newjawin
    2,. start codegenerator (exe)
    3. choose COM-Component (f..e. winword.exe)
    4. press "generate"-Button
    5. Use Javaproxyclasses to access full MS Word
    Or you can use a commercial software like J-Integra that provides ready-to-use Java API to access Word. The benefit of using this tool  is that it exposes all the formatting tools Word provides like adding header, footer, page numbers, tables, etc. Also, if you require user interaction to manipulate the Word document, you can listen to Word events from your Java program and implement event handlers accordingly.

  • Quickest method for reading and writing files

    Hi
    I need help regarding file operations.(Reading and Writing). Currently I am using BufferedReader and BufferedWriter to read and write files. But the files (XML) are very huge files(from 30 -50 mb). This is slowing the application to a great extent. Is there any other approach to perform the above mentioned operations on XML files in a fast manner.
    Thank You
    Mansoor.

    Hi
    Can u let me know how to use the java.nio pavkage for primitve data types(int,float..., boolean). I have tried it but found no success.
    Thank You
    Mansoor

  • How to read and XSD file in java prospective in NWDS

    Hi !!
    anybody can help me that
    how to read and XSD file in java prospective in Netweaver developer Studio
    Regards
    Abhishek Agrahari

    I guess you can make it more clear...

  • What do I need to do to be able to read and write files to a Seagate Backup Plus Slim Portable Drive on BOTH a Mac and a PC? I downloaded "Paragon NTFS for Mac" onto my Mac, so now I can write to the drive, but when I plug it into a PC it won't work.

    What do I need to do to be able to read and write files to a Seagate Backup Plus Slim Portable Drive on BOTH a Mac and a PC? I downloaded "Paragon NTFS for Mac" onto my Mac, so now I can write to the drive, but when I plug it into a PC it won't work.

    If the HDD is formatted NTFS, then it suggests that there is a problem with the PC.  Check with the manufacturer.
    Ciao.

  • Read and write files

    i am using IE as brower,. how do i change the properties so that i can let an applet to read and write files on my system? thank you, for help.

    DON'T POST MULTIPLE TIMES!
    Proper English:
    I am using Internet Explorer as my web browser. How do I change the properties so that an applet can read and write files to my local system? Thanks for any help.
    Answer) Search on Java and security in the forum search or google. This topic is covered numerous times.
    DeltaCoder

  • I have downloaded adobe reader and my file still wont open

    I have downloaded adobe reader and my file still wont open

    Have you accepted the license agreement for Reader?
    If not, go to C/Program Files (or Program Files (x86))/Adobe/Reader 11.0/Reader
    Double click the "eula.exe" file (it may just say "eula")
    Accept the license agreement.
    Open Reader and you should be able to open PDFs.
    If it's another issue, please let us know.

  • Large File Reading and Processing

    Hi:
    Suppose I have a file much larger than my computer's memory e.g. say on a Windows XP system, the memory is 256 MB RAM and the file size is 1 GB on disk. Now if I want to create a File object and read from this file, is this possible to do? If yes, how about the performance?
    I understand that this is more of an Operating System question but nevertheless it affects the Java process.
    Thanks!
    Rahul.

    If you mean, you plan to read the whole file into memory, then:
    Theoretically possible, sure. The process would be much bigger (in terms of memory used) than the amount of memory available, which means that it would start swapping out to disk, and that would reduce performance, although to what extent depends on XP's virtual memory implementation, which I know nothing about.
    But if all you mean is that you want to create a File object and read bits of the file, it won't make any difference. File represents a name or description of a file, not the file itself (you can create File objects for files that don't exist). So it doesn't need to read the whole into memory just to create a File object. You can easily create a File object for the huge file, and then read it in line by line, throwing away old lines as you go, and you won't use up very much memory at all. (Unless, of course, there's some horrible weird artifact of XP that I'm not aware of.)

Maybe you are looking for