Is there a way to make my program parse a bunch of files?  Design advice!

Hello everyone.
Currently my program does parses up a file and spits out a new file (its more complicated than that but in a nut shell thats what it does).
The main function looks like this:
package corysanchez.rodmload;
public class Main
     public static void main(String [] args)
          ConversionTableParser classNameFile = new ConversionTableParser();
          classNameFile.parseFile("classNameConversion.txt");
          JavaParser javaFile = new JavaParser();
          javaFile.parseFile("interface.txt");
}If you look at this code, that interface.txt is 1 file its parsing and its generating a new file called INTERFACE.SMP once this program is done running.
Now what if there was a whole directory of files I want to run this program with?
Like I want to pass in via command line, a directory, and I want my program to Search that directory and Run every file in that directory through my program.
So my program would see
javaFile.parse("file1.txt");
javaFile.parse("file2.txt");
javaFile.parse("file3.txt");
etc...
I wrote this program in Rexx and I'm rewriting it in Java. How I did it in Rexx was I created a script that would Search a directory, and call the whole program and just pass in an array of file names it found.
Like if my above program was called Parser.exe.
I would call Parser.exe <pass it an array of file names>
then inside Parser.exe it would run the javaFile.parse(file1.txt);
I was hoping there was a better method on how to accomplish this in java rather than writing another java program and calling this program via command line.
Thanks!

If you declare the file using the directory instead of a filename, you can use
File directoryInQuestion = new File("./yourdirectory");
File[] allTheFiles = directoryInQuestion.listFiles();
for ( int i = 0; i < allTheFiles.length(); i++ ){
   if ( allTheFiles.isFile() )
do whatever to allTheFiles[i]
Hope that's helpful :D
Edited by: the.maltese.falcon on Nov 8, 2007 3:13 PM
good call on the subdirectories, helloWorld                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Microsoft EXEL and Word users, is there any way to make the program fill

    the whole screen? Like in Windows? i really dont like all these menus flying everywhere...
    any thoughts?
    thanx!!

    You can try using this.
    It doesn't keep the menus from "flying everywhere" (that's just the way things work on the Mac; actually, some Linux environments too), but at least it makes it possible to maximize the apps to full screen.

  • Is there any way to make a socket connection to a java file on the net?

    Is their anyway to make a socket connection to a java applet that I place on a webhost? I want to connect to a javaapplet from my vb.net program and send commands to it. Like http://www.geocities.com/Sylonious/javafile.jpx:7070
    ?

    Is their anyway to make a socket connection to a java
    applet that I place on a webhost? I want to connect to
    a javaapplet from my vb.net program and send commands
    to it. Like
    http://www.geocities.com/Sylonious/javafile.jpx:7070
    ?You wouldn't have a port in the url, you would need to have the socket open in the applet code. The vb.net program would also need to be on the same server as the applet or you'll have security issues and I doubt that's possible with geocities. I don't know what you would need to communicate with a vb.net if anything, but I'm sure it's possible.

  • HT4859 I used a purchased program iannotate to download, highlight and store many documents. My ipad is brocken and I m ahtinking of getting it replaced by Apple for a payment of 240 or so. Is there a way to make sure that I do not lose pdf documents in i

    I used a purchased program iannotate to download, highlight and store many documents. My ipad is brocken and I m ahtinking of getting it replaced by Apple for a payment of 240 or so. Is there a way to make sure that I do not lose pdf documents in iA?

    I am sorry that you don't find the answer to be correct. In THIS forum, telling you that you are in the wrong forum, and suggesting where to post for correct answers, or indeed any support, IS the answer.
    I'm also sorry that you purchased a phone that you are having trouble with. If the vendor cannot help you (HTC), and the eBay seller cannot help you, then you really do need to either follow up with the forums Ken suggests, or the HTC forum, or with eBay.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog:http://unlockpowershell.wordpress.com
    My Book:Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Is there any way to make Mail open next message?

    Is there any way to make Mail open the next message on the inbox automatically after deleting, forwarding o saving a message?
    I mean, is there any way to, after reading a message, going to the next or previous message without double clicking the main inbox window?
    I used (on windows) to read mail on outlook, or even on entourage for mac, and after I read a message, even if I deleted it, forward it, replied it, or even saving it on a folder, automatically the program (outlook, entourage, hotmail, etc) opened the next message on the inbox, but I am not able to find any way to make Mail do that.
    Is there a way to it? Or should I provide suggestions to Apple?
    By the way, no meant to prefer microsoft for this, I just think this is a cool feature for reading several messages one after another without going back to the main inbox page and double clicking the message to read...
    Thanks for any help

    Down-arrow, Return. Return opens the selected message. I read through hundreds of messages without ever touching the mouse. Once you get used to the keystrokes, Mail is extremely efficient.

  • Is there a way to make Illustrator save in the background, like Photoshop?

    Out of Photoshop, InDesign and Illustrator, Illustrator is definitely the one I have most problems working with, due to small UI differences and ways of handling things
    Like the fact that you can't drag next to a number to change it, like in Photoshop. Or the fact that I can't sync my settings (it only says "Signed in as:", and when I press Manage Account, I'm taken to my CC files in Safari).
    But most annoying is the fact that whenever I'll save a document in Illustrator, a dialogue box opens letting me know the progress of the saving. Not only does this make me unable to continue working on the document (if the file is large, it takes some time), the app icon starts jumping in the dock if I switch to another program before the box appears.
    So, is there any way to make it save in the background, like in Photoshop? I'm running OS X, with Illustrator version 17.1.0.

    This really frustrates me, small differences between the apps that shouldn't be there.
    I understand you can't change the keyboard shortcuts to be the same/similar, but this is totally different. Let's hope it changes soon.

  • Pages: Is there a way to make lines independent, like a real word processor

    There are so many things that infuriate me about Pages. Save As.. missing, autosave, etc which are NOT like 99% of other apps on the Mac.
    Specifially (today):
    I have a letter in Pages. It’s a standard business letter you have see 1m times.
    After the first line of the address, at the top of the letter, I insert a carriage return and BINGO, the tabs in the middle of the letter are suddenly all messed up.
    Grrrrrr.
    Is there a way to make lines independent in Pages? I have this crazy belief that letters are not Web Pages, not HTML, and that an extra line somewhere should not reformat following lines way down the page.
    Alternately, is there some 3rd party word processor that works like the old Apple Works, with graphics and tables you can recommend?
    Thanks

    William Donelson wrote:
    There are so many things that infuriate me about Pages. Save As.. missing, autosave, etc which are NOT like 99% of other apps on the Mac.
    Save As is still there, hold down the option key as you go to the File menu. This is not Pages, it is Mountain Lion.
    Specifially (today):
    I have a letter in Pages. It’s a standard business letter you have see 1m times.
    After the first line of the address, at the top of the letter, I insert a carriage return and BINGO, the tabs in the middle of the letter are suddenly all messed up.
    Grrrrrr.
    Then you are doing something wrong, probably pounding away at spaces, tabs and returns to position things. Turn on invisibles to see what is going on:
    Menu > View > Show Invisibles
    If you have strings of tabs, spaces and returns that is the problem.
    Is there a way to make lines independent in Pages?
    Yes, hit the return key. Like every other Word Processing program.
    I have this crazy belief that letters are not Web Pages, not HTML, and that an extra line somewhere should not reformat following lines way down the page.
    Alternately, is there some 3rd party word processor that works like the old Apple Works, with graphics and tables you can recommend?
    Time to learn Pages. AppleWorks is dead. Stop pining for it. This is a case of user error and instead of blaming Pages, it would pay to find out what you have done and stop doing that.
    Pages, except for the fancy DTP features, tables and charts works like most other Word Processing apps. Just a case of learning new tricks. My guess is you have other stuff going on.

  • The PC that my ipod was connected crashed and i wanted to switch it to my laptop now..the question is will i lose all my pictures and notes from my ipod if i switch PC's or is there a way to make it stay since i have icloud backup on my ipod.

    hi...the pc that my ipod was connected crashed and i wanted to switch it to my laptop now..the question is will i lose all my pictures and songs from my ipod if i switch PC's or is there a way to make it stay since u have icloud backup on my ipod. i really dont want to lose my pictures so plz let me know if there is a way...thank you

    The iCloud backup does not include non-Tunes purchased music and photos that were synced to the iPod. The iCloud backup does not also included a few other things included in the iPod backup that iTunes makes.
    The iPod backup that iTunes makes does also not included non-iTunes purchases and photos synced to the iPod.
    free programs like iFunBox with copy non-iTunes purchased music and some other things from iPod to computer.  A paid program like TouchCopy is needed to copy photos synced to the iPod to a computer.

  • In LabVIEW6i, is there a way to make particular elements of an array invisible while the others stay visible (without losing any element's info.)?

    I have an array of clusters. Each cluster pertains to a certain oscilloscope I am controlling. There is another control which specifies which oscilloscopes I have "on".
    If a particular oscilloscope is "on" I want its cluster to be VISIBLE in the array. If a particular oscilloscope is "off" I want its cluster to be INVISIBLE in the array.
    How can I implement this in my program without losing ANY of the info. in my array?

    I suggest to use two arrays; one for user interface holding the ON clusters,
    and one for internal use holding all clusters. The diagram periodically
    updates the internal array with user interface array data.
    By INVISIBLE do you mean "skipped from the array" or displayed as an empty
    placeholder? To hide an OFF cluster you could put in the cluster a flat
    button boolean that is small and transparent when ON and large enough to
    cover the whole cluster area (and other controls) when OFF.
    Jean-Pierre Drolet
    Scientech R&D
    "mcmastal" a écrit dans le message news:
    [email protected]..
    > In LabVIEW6i, is there a way to make particular elements of an array
    > invisible while the others stay visible (without losing any element's
    > info.)?
    >
    > I have an array of clusters. Each cluster pertains to a certain
    > oscilloscope I am controlling. There is another control which
    > specifies which oscilloscopes I have "on".
    > If a particular oscilloscope is "on" I want its cluster to be VISIBLE
    > in the array. If a particular oscilloscope is "off" I want its
    > cluster to be INVISIBLE in the array.
    > How can I implement this in my program without losing ANY of the
    > info. in my array?
    LabVIEW, C'est LabVIEW

  • Is There a Way to Make the Background App Be Useable?

    Hi. Is there a way to make the background useable? For example, you have a fullscreen only app in the background and you want/wanted (which is the correct grammar btw, those who're native speakers and why?) and you have Safari for some tutorial, is there a way to access the background app (for example if it's a drawing app you're learning).
    It is possible I guess if the background is/was (which is the correct grammar again btw and why) was resizable.
    Thanks in advance.
    Gbu.

    Another way to be able to get to the tutorial in Safari would be to double-click the titlebar of the drawing app's window. Doing that should minimize it, dropping it into the Dock, thus making the Safari window visible. You can bring the drawing back up and front by clicking its icon in the Dock.
    I can see a lot of confusion happening if it were possible to have the top window inactive and one in the back of it active. One would have to be really alert as to which window was the active one, to avoid something happening in the wrong place. I'm glad it doesn't work that way.
    As far as the drawing app not behaving in accordance with Apple's guidlines re full-screen windows, well, that's on the publisher of the program. Apple publishes developer guidelines for a reason.

  • Is there a way to make Photoshop Elements 5 (2006) compatible to a Dell Windows 7 laptop?

    I received a copy of Photoshop Elements 5 (2006) and have a Dell Windows 7. I installed and registered my name to the software, but am aware that the program is compatible with Windows Vista or XP. Is there a way to make it compatible to my computer and/or update/upgrade to a more recent version? If there is no way to make the program work for my computer, is there a way to un-register my name from it?
    Thank you for any help at all!
    -Blair Gorman

    Do you get any problems when trying to run the software on Windows 7?  If yes, try to run it under Windows XP or Vista Compatibility Mode.

  • Is there any way to make fade transitions in movies using quicktime pro 7?

    is there any way to make fade transitions in movies using quicktime pro 7?

    thanks. i eventually found your discussion trace from a few years ago on this shubject--after i posted my question. i do have i movies--another program to learn--which i guess does have the ability to do fade transitions. i'll figure it out....
    vr
    dr

  • Is there any way to make work item invisible in the SAP inbox?

    Is there any way to make work item invisible in the SAP inbox?
    If yes , How?
    How can we delete a work item without using SAPLSINWP program?Is it possible???

    Thanks suresh, But I was a looking for a solution where as soon as the work item is created should be made invisible in the SAP inbox, is there any way for this or any other alternative?

  • Is there a way to make Ipod Nano 6 think that a movie is Music Video?

    Is there a way to make Ipod Nano 6 think that a movie is Music Video? That is all I want to know. I can program so if I need to go into terminal, I'm fine...

    If there is, I'm sure that it doesn't involve Pages (for Mac OS X), the topic in this community.
    The iPod nano has a community of its own, which might be better suited to this question.
    You might also want to check out the Apple Support Communities Terms of Use statement, with particular attention to section 2.8. That could have a bearing on whether you get an answer.
    Regards,
    Barry

  • Is there a way to make a smart "playlist" of specific books in my iTunes library, and copy ONLY THOSE books to an iOS device? I own an iPad and an iPhone but I want different books on different devices.

    Is there a way to make a smart "playlist" of specific books in my iTunes library, and copy ONLY THOSE books to an iOS device? I own an iPad and an iPhone but I want different books on each different device. When I've tried this, the iOS devices don't seem to respond.

    There is no playlist for iBooks, butther eis nothing to preent you from choosing to download specific titles from itunes, or syncing just specific titles to an individual device.

Maybe you are looking for

  • Sales order schedule confirmed date will consider Production capacity load

    As we know about schedule confirm delivery dates of sales order will consider based on material master lead time ,shiping point etc How to consider production capacity plan on sales order's delivery date. Say for example : Production workcenter capac

  • Weather not showing in my notification drop down iOS 7

    Please advise how I can get weather in iOS 7 to show in notification centre drop down on home screen. thank you.

  • Routine to convert dats to dec format

    Hi experts..                  I have one cube having date in DEC format and flatfile having date in DATS(yyyymmdd) format. i have used a routine in transfer rules as follows.. DATA: dats1 type p. dats1 = TRAN_STRUCTURE-calday. RESULT = dats1. but i m

  • Read file in chunks

    hello, as many of you know i'm trying to solve a problem memory with labview 7.1 many of you told me to read file in chunks and i'm trying to do it... but i have some questions... in attachment you find see my VI (it's incomplete): i would read my fi

  • Unknown Adobe logo in Win8 Taskbar?

    Upon startup on a new Win8 laptop, there is an Adobe logo on the task bar that leads nowhere. When I hover over, it is a grey square with no preview, and when I right-click it opens the menu showing 'Adobe' under the HP Launch Box. This laptop only h