Issue with multiple files merging into 1

I'm trying to write some code that will read the contents of multiple files in a directory then output it into a single file. However when I try to open the files via a for loop it does not recognise the variable I have assigned for the filename:
FileReader fr = new FileReader(fileName);
please see the full program so far, it isn't finished and this currently has me beat, any help would be greately appreciated.
Thanks
Chris
import java.io.*;
public class OutputCCFile
          public static void main(String []args)
               File absolutePath = new File("C:\\java\\Credit Cards");     
               String[] ccFiles = absolutePath.list();
               try
                    boolean newFile = false;
                    CCHeaderLine cch = new CCHeaderLine();
                    String strDate = cch.getDate();
                    String headerLine = cch.getHeader();
                    File file = new File("TUHCC_"+strDate);
                    FileWriter fw = new FileWriter(file);
                    fw.write(headerLine);
                    fw.flush();
                    fw.close();          
               }catch(IOException e) {}
               for (int i = 0; i<ccFiles.length;i++)
                         String filename = ccFiles;
                         filename.toUpperCase();
                         if (filename.startsWith("C")) //only want to open files beginning with C
                                   FileReader fr = new FileReader(fileName);
/*Exception in thread "main" java.lang.Error: Unresolved compilation problem:
     fileName cannot be resolved */
                                   BufferedReader br = new BufferedReader(fr);
                                   String dataLine = br.readLine();

String filename = ccFiles;
filename.toUpperCase();
if (filename.startsWith("C")) //only want to open files beginning with C
FileReader fr = new FileReader(fileName);
There are several problems here.
1) Variable names (and many other things) are case sensitive in Java. filename != fileName
2) filename.toUpperCase(); will not change filename, it will just determine its upper case version and discard it                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Issues with multiple Files with multiple subdbs on a single environment.

    I'm having an issue with Berkeley DB 4.2 on 32-bit platforms, regarding multiple physical files with multiple subdatabases in a single database environment. Specifically, when I open a subdatabase for a physical file, Berkeley DB thinks that it is using the same subdatabase in a different physical file.
    I'm doing the following:
    1. Create and open a db enviornment.
    2. Move file1 to the common area.
    3. Open, get and close the subdatabases in file1.
    4. Move file2 to the common area.
    5. Open, get and close the subdatabases in file2.
    6. remove file2 from the common area
    7. Move file3 to the common area.
    8. Open a subdatabase from file3. About 1/2 the time, the fetches
    return data from file2, not from file3.
    It's possible that at some earlier time (i.e. before step 1 of this
    test case), file1, file2 and file3 were the same file. I noticed
    that there is something called env->fileid_reset, but that is not
    in 4.2.52.
    Any ideas?

    Looks like I've resolved the issue

  • Re: Issue with multiple records loading into cube

    Hello Gurus,
    A report is run on a monthly basis for Billing commissions. Info cube has all the data related to the Billing commission.
    It has a custom field for total commissions for which the data gets populated from the DSO based on the Billing
    document conditions. Look up has been done for the total commissions field. Most of them are showing up
    the right values, but few billing documents are showing up the wrong values.
    I made an attempt by reloading  the effected Billing documents into Info cube, now the code works and
    total commissions are showing up right values. I tried selective deletion and loaded the data for the whole month,
    the billing documents again show up the wrong values. These billing documents show up the right values when
    they are loaded individually.I tried checking if the code was wrong, but it was working when the effected ones
    are loaded individually. Please let me know your suggestions on this. Thanks in advance

    Nanda,
    Please find the start routine below
    Z9SD_O21 = Billing document header
          L_ZUARC like /BIC/AZ9SD_O2300-INV_QTY,
           L_ZUART like /BIC/AZ9SD_O2300-KPRICE,
           L_ZCGU like /BIC/AZ9SD_O2300-KNVAL,
           L_ZCTU like /BIC/AZ9SD_O2300-KNVAL,
           L_ZCNU like /BIC/AZ9SD_O2300-KNVAL,
           L_ZCQU like /BIC/AZ9SD_O2300-KNVAL,
    FORM SELECT_POST_ST
        USING COMM_BILL_NUM LIKE /BIC/AZ9SD_O2100-DOC_NUMBER.
    *         COMM_BILL_DATE LIKE /BIC/AZ9SD_O2100-BILL_DATE.
       IF COMM_BILL_NUM <> /BIC/AZ9SD_O2100-DOC_NUMBER.
    *  OR COMM_BILL_DATE <> /BIC/AZ9SD_O2100-BILL_DATE.
         CLEAR /BIC/AZ9SD_O2100.
         SELECT SINGLE DOC_NUMBER /BIC/ZPOST_ST
         INTO (/BIC/AZ9SD_O2100-DOC_NUMBER,
    *          /BIC/AZ9SD_O2100-BILL_DATE,
               /BIC/AZ9SD_O2100-/BIC/ZPOST_ST )
         FROM /BIC/AZ9SD_O2100 WHERE
          DOC_NUMBER = COMM_BILL_NUM.
       ENDIF.
    ENDFORM. "SELECT_POST_ST
    *$*$ end of global - insert your declaration only before this line   *-*
    * The follow definition is new in the BW3.x
    TYPES:
       BEGIN OF DATA_PACKAGE_STRUCTURE.
          INCLUDE STRUCTURE /BIC/CS8Z9SD_O24.
    TYPES:
          RECNO   LIKE sy-tabix,
       END OF DATA_PACKAGE_STRUCTURE.
    DATA:
       DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
            WITH HEADER LINE
            WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    FORM startup
       TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
                MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
                DATA_PACKAGE STRUCTURE DATA_PACKAGE
       USING    RECORD_ALL LIKE SY-TABIX
                SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
       CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    *$*$ begin of routine - insert your code only below this line        *-*
    * fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    * to make monitor entries
    * if abort is not equal zero, the update process will be canceled
    * DELETE DATA_PACKAGE WHERE STORNO = 'X'.
    * DELETE DATA_PACKAGE WHERE /BIC/ZPSTAS = 'A'.
    * CG: 07/02/07 Assign Summarization group for each partner function
    * based on Master Data.
       DATA: LV_LINES TYPE I.
       DATA: LV_RETURN(1).
       DESCRIBE TABLE DATA_PACKAGE LINES LV_LINES.
       IF LV_LINES > 0.
         CLEAR: LV_RETURN, SY-SUBRC.
         CALL FUNCTION 'Z_FIND_SUM_GROUP_2'
           IMPORTING
             MY_RETURN                      = LV_RETURN
           TABLES
             IT_DATAPACKAGE                 = DATA_PACKAGE
           EXCEPTIONS
             GENERAL_ERROR                  = 1.
       ENDIF.
       ABORT = 0.
    *$*$ end of routine - insert your code only before this line         *-*
    ENDFORM.

  • "Place into Photoshop" with multiple files

    I'd love to see this feature in Bridge
    Import multiple files into an existing photoshop file (with a predetermined size ) as smart object layers in photoshop.
    The options that Bridge currently offers falls short in 2 area
    Load Files into Photoshop Layers-- does not import smart objects and creates a new photoshop file that ends up being as large as the largest imported file
    Place into Photoshop--only lets you do one at a time
    I need "Place into Photoshop" with multiple files
    Is there a way to do this?
    Thanks!!

    I agree, placing multiple files into your PSD as smart objects all at once like InDesign would be a great (and logical) feature for Photoshop to have. The only "workaround" I have is to create a shortcut using Ctrt+Alt+Shift+D (which is not used by anything), so you can place pictures/graphics more quickly, rather than using the menu each time.

  • We run an iMac 3.4 GHz I7 for our church worship service; we haven't upgraded to Mavericks because we heard about issues with multiple screens crashing.  Has this issue been resolved?  Thank you!

    We run an iMac 3.4 GHz I7 in our church worship service; we have front screens and a stage display monitor ; we haven't upgraded to Mavericks because we heard about issues with multiple screens crashing.  Has this issue been resolved?  Now that we are 2 upgrades behind, I'm getting little concerned.  Thank you!

    Oh, well that was a whole other kettle of fish:
    Oh the G4 I attempted to install iLife '08 before Lepoard was available. About the only thing that installed cleanly was iPhoto. I ended up reinstalling everything back to iLife '06, and then upgrading back to the current stable version of the iLife '06 version. I didn't attempt a reinstall until after I upgraded to Leopard.
    When I did reinstall, I made a iLife '06 folder, copied all iLife apps into it, and upgraded. Seemed to work, except for the part where iMovie gets left behind and iDVD is only mostly functional.
    When I installed on the other 2 machines, it was after installing Leopard and all upgrades. On those 2 machines, I didn't bother with the copy, I just moved everything to the iLife '06 folder I created, and did a fresh install.
    I didn't have to do anything with the iPhoto Libraries, that I can recall.
    I always do an upgrade, never an archive and install. I've never had a problem with this back to 10.1 or 10.2.

  • A serious issue with excel file read in ODI

    hi gurus,
    Issue with excel file read is that we can read only one file by setting the path from ODBC Data Source Administrator-->System DNS -->Select Work book
    what i want to read the dynamic path(Every time I cant go back and set the Work book to select the excel file..
    So i came up with a solution to write a Vbscript that convert the excel to csv my problem got solved for dynamic paths the script is as follow:
    Set objArgs = WScript.Arguments
    For I = 0 to objArgs.Count - 1
    FullName = objArgs(I)
    FileName = Left(objArgs(I), InstrRev(objArgs(I), ".") )
    Set objExcel = CreateObject("Excel.application")
    set objExcelBook = objExcel.Workbooks.Open(FullName)
    objExcel.application.visible=false
    objExcel.application.displayalerts=false
    objExcelBook.SaveAs FileName & "csv",23
    objExcel.Application.Quit
    objExcel.Quit
    Set objExcel = Nothing
    set objExcelBook = Nothing
    Next
    Now this script convert the xls file to csv with comma seprated values
    e.g in excel sheet if data is ABC XYZ PQR
    csv will come with ABC,XYZ,PQR
    here the delimiter is , i want the delimiter as pipe | who's ascii code is 124
    but if i change 23 with 124 its not working i getting the error cannot save as...
    can anyone tell me that what should be the correct code for pipe
    so that the output is ABC|XYZ|PQR
    AS WE CAN USE THE SCRIPTS IN TOOLS
    Edited by: 789141 on Sep 14, 2010 11:33 PM

    I dont have the answer for your question but i have different approach in handling multiple Excel File.
    Step 1. Copy a sample source Excel File and Call it Final.xls .
    Step 2. Map this Final.xls to DSN and in Topology call this Final.xls
    Step 3. Do the Reversing and Map and test the Interface . Once its done.
    Step 4. Create a Package and using a http://odiexperts.com/?p=1426 get the list of all the Excel File
    Step 5 . Using this http://odiexperts.com/?p=273 create a Loop to Read the Excel File name
    Step 6 . Copy using OdiFileCopy to Final.xls and run your interface .
    Step 7. Increment the Loop and copy your next File for Final and run the interface
    Step 8 . Finally you will be able to read all the Excel File .
    Step 9 . Delete the source file [ Optional ]
    Hope this helps.

  • Generate Proxy from WSDL with multiple Files

    I need to load a WSDL (to generate a web service consumer proxy). However, that WSDL is build from multiple files, both .wsdl and .xsd, not a single one. It seems the SAP wizard to generate the proxy does expect one single WSDL file however.
    Is there a way in SAP to load a WSDL with multiple files, or do I need to (manually) flatten all these files into one single file?

    I am not sure why it fails in WebSphere. Please try posting
    this question to a WebSphere newsgroup.
    Regards,
    -manoj
    http://manojc.com
    "viswanath" <[email protected]> wrote in message
    news:40aee7fa$1@mktnews1...
    >
    thanks manoj for your reply.
    I'm using IBM WebSphere SDK for Web Services v5.1
    for generation of java client.
    I'm able to generate the client but the problem is
    the WSDl2Java command ignored the SOAPHeaders while
    generating the proxy. Since I'm using SOAP headers for
    authentication the code fails.
    Thanks,
    Viswanath
    "manoj cheenath" <[email protected]> wrote:
    I am not sure which tool you are using
    to generate web service clent. To generate
    a WLS web service client you have to use clientgen.
    Details here:
    http://e-docs.bea.com/wls/docs81/webserv/anttasks.html
    Regards,
    -manoj
    http://manojc.com
    "viswanath" <[email protected]> wrote in message
    news:40ad8a07$[email protected]..
    HI,
    I have a web service (implemented in .NET) which extends soap headersfor
    doing
    Authentication. WSDL is generated out of this web service. But wheni use
    wsdl2java
    (J2EE) to generate a proxy class, there is no interface generated forsoap
    headers.
    Without extending SOAP headers the web service works fine.
    Basically, I'm looking for a way to generate java interfaces (ie.
    proxies)
    for
    SOAP headers out of the WSDL file.
    PFA the WSDL file and the proxy
    Any help on this is appreciated.

  • Since I've installed Mountain Lion, I am having lock up issues with multiple programs. MS Outlook has crashed and I've lost all my folders. HELP?

    Since I've installed Mountain Lion, I am having lock up issues with multiple programs. MS Outlook has crashed and I've lost all my folders. HELP?

    okay I've finally been able to get tor and all the other programs to work according to my plan the only thing that's still making problems is that iptables doesn't work as I want it to, when I start chromium without proxy settings privoxy doesn't seem to forward the information to polipo.. do I need to add another rule to iptables.rules in order for the program to know it has to reroute the information again or how can I get this to work? and is there any way to run rtorrent with proxy support?
    anyway, problem 2 and 3 are still to be solved.
    and does anybody know where i can get a good dansguardian blacklist that was not designed for 6 year old children and for which I don't need to subscribe? I'm still getting these partypoker popups -.-
    //e: with iptables it's the same thing as described in the first post. https works, http doesnt. I get the output "Invalid header received from client." on http sites. still no idea why though.. (and the https-version of torcheck.xenubite says i'm tor unprotected while starting the browser with iptables)
    Last edited by deF291 (2011-04-23 16:16:31)

  • Working with Multiple Files in Workspace Layout

    If I was working with multiple files in the workspace layout, they each used to be available for selection from a tab.  Now I can either cascade the files horizontally or vertically - but not have them appear in a tab across the top of the workspace layout.
    Does anyone know how to set the workspace to present multiple files in tabs?  I have CS3.

    Tanya,
    This may not help, but the times when that happens to me is when I go too fast and some operations haven't finished. I then try to select a file that hasn't completed and the file I select is in the process of having the data updated. The worst is when it is trying to render as I am doing something.
    I hope this helps some.
    Mel

  • Hi.  I am having issues with copying files to my shared WB 2TB HDD connected to my airport extreme.  Comes up with error 50.  I am using a Macbook Pro to copy from so not sure what I am doing wrong.  Can someone help? thanks Rory

    Hi.  I am having issues with copying files to my shared WB 2TB HDD connected to my airport extreme.  Comes up with error 50.  I am using a Macbook Pro to copy from so not sure what I am doing wrong.  Can someone help? thanks Rory

    These links might provide some information that may be of help.
    http://support.apple.com/kb/TA20831
    https://discussions.apple.com/message/2035035?messageID=2035035
    I've encountered this error myself upon occasion.  If I remember correctly, it was a permissions/ownership issue with the some of the files I was copying.

  • Problem Creating PDF with Multiple Files in Pro. 7

    I'm using Adobe Acrobat Professional 7 on a computer with Windows XP.
    The problem is that when I try to create a PDF with multiple files everything just suddenly stops. There are 75 files involved and when it gets to around 41 or so (don't know the exact number because I turned away from my computer for just a moment), it just stops. There are no error messages; nothing. Just a blank Acrobat screen.
    Last week I had a different problem which was resolved by an uninstall/reinstall and I was able to create the PDF with those exact same 75 files, but after the PDF was created I realised that some changes needed to be made. I dumped the PDF, made the appropriate changes and left it for the weekend. Today I the new problem has arisen.
    Any ideas what the problem might be?

    I've read many discussions about Acrobat and problems with server files, with the general solution being what you are doing... copy the files to a local hard drive

  • I am having issues with Sidebar files not appearing from within InDesign CS5.5. They show up fine from other Adobe applications. Using OS10.6.8.

    I am having issues with Sidebar files not appearing from within InDesign CS5.5. They show up fine from other Adobe applications. Using OS10.6.8.

    I would first of all trash the preference file for InDesign, make sure the application is closed then find the prefs in
    /Users/USER NAME/Library/Preferences/Adobe InDesign and just throw the entire folder away, it will generate a new one after you launch InDesign again.
    Now launch InDesign and see if the problems are resolved.
    If not I would repair your permissions on your hard drive wih disk utility, and if that fails then di-install InDesign and re-install that single application.
    Let me know if any of these suggestions work for you
    I will be checking my email although you might have to wait for a response as I will be taking a microlight flight over the Victoria Falls tomorrow. Yay can hardly wait.

  • Issue with Sender File FCC

    Hi Experts,
    I have an issue with Sender File FCC Adapter. The file being picked is of type TXT and it is tab seperated. The first line contains the field names and from next line onwards we have values for those fields.
    The field names and field values are tab seperated. Even inserting a single letter in some field value manually disrupts the whole setup & alignment of the TXT file and the Sender File CC is unable to pick up the file from the shared folder. If the first file is errorenous and after that a correct TXT file is posted, it fails to pick up the correct file as it is trying to pick the errorenous file first.
    The Error thrown is :
    "Conversion of file content to XML failed at position 0: java.lang.Exception: ERROR converting document line no. 2 according to structure 'ABCD':java.lang.Exception: ERROR in configuration / structure 'ABCD.': More elements in file csv structure than field names specified!"
    I have two questions:
    1. Is there a way to handle such a scenario? For e.g., the errornous TXT file gets picked but throws error in PI.
    2. Is there an alternative that the sender FCC channel picks up the correct files and filter out the errorneous ones ? ?
    Thanks,
    Arkesh

    Hi Arkesh,
    I think you are passing more number of fields than expected. Please check paramters defined and send the data accordingly.
    In the processing parameters tab of sender file adapter, you have an option called Archive faulty source files, below to that you would have option to enter the " Directory for Archiving files with Errors".
    I hope this helps you....
    Thanks,

  • Issue with attachment file name

    Hi All,
    This is about an issue with attachment file name:
    we have a scenario wherein we have payload with attachments ...(attachments can be any doc ,pdf) , problem is main document is comming with messageid.sap.com and thats normal but attachments are comming with file names for example something.pdf or something.doc or something.txt ...this is failing in adapter as it expects same name as u have in main document...anybody have any idea to get through this issue...
    Regards
    kiran

    we have a scenario wherein we have payload with attachments ...(attachments can be any doc ,pdf) , problem is main document is comming with messageid.sap.com and thats normal but attachments are comming with file names for example something.pdf or something.doc or something.txt ...this is failing in adapter as it expects same name as u have in main document...anybody have any idea to get through this issue...
    - <SAP:Payload xlink:href="cid:payload-4CED452F17C601BDE10080000A492050---sap.com">
      <SAP:Name>1 .Header1.txt</SAP:Name>
    Error we are getting is
    Cannot cast 'Header' to boolean] in class com.sap.aii.mappingtool.flib7.NodeFunctions method createIf[Header, com.sap.aii.mappingtool.tf7.rt.Context---27a73bfa]
    So we have to change the File name Header1.txt to something which we can cast to creatif....(we cannot tell the sendr to change the file name as its is set already)
    Thanks for interste and assisting
    Regards
    Kiran

  • Issue with corrupted file when dragging to timeline

    Has anyone ever had an issue with a files audio becoming corrupted when moving the file from the editing window to the timeline.  I am also seeing the my camtasia mp4 becomes blurry on the timeline but plays fine in the editing screen.
    I had not problem with camtasia Mp4s previously and today I have had so many issues with premier pro

    Hi,
    Even i faced this issue before...the problem with file adapter is the attribute nxsd:quotedBy takes &quot; as default even if u dont mention it takes the same and now after the quotes it immediately expects | wch is not there in the data and it throws the error...now the fix for the problem is put some symbol for nxsd:quotedBy wch u never expect in the data some thing like less than or greater than symbol ....some thing like below
    <element name="FieldTwo" type="string" nxsd:style="terminated"
    nxsd:terminatedBy="|" nxsd:quotedBy="<"/>

Maybe you are looking for

  • ITunes Sync causing Alarms to Disable

    Every time I sync my iPhone with iTunes my Alarms get disabled on my phone, I've had a new iPhone via Insurance after dropping it, the new iPhone does exactly the same? Is there any file I can delete on my PC Relating to Alarms only so it stops doing

  • Why I can't apload a video on YouTube on a iPad

    After I made a channel why it's not letting me post a video to YouTube

  • Links Color Wrong in CS3

    I defined a link to be red, a visited link green, a hover blue, and an active yellow. The link is red in Dreamweaver Design view; however, in IE 7 the link is green and the visited link yellow. The hover and active colors are correct. I've attached t

  • Streaming a movie on my ATV 2nd generation and it stops syncing

    Having syncing issues when streaming a movie on my ATV, it stops in the middle of the movie

  • Volume control for Inspire p380

    Hi all. My volume control has broken and not working properly. How do I get a spare? Inspire P380 serial: CAMF055300S963B _http://dump.ru/file/3245602 Foto Broken part number MS0550B 00323 I am russian living in Moscow