Results 1 to 18 of 18
  1. #1
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default FileWriter error

    Hi. I have just experienced something new. I am reading multiple files from one directory and writing multiple files to another directory. The problem seems to be that, sometimes, one file is not finished writing before the next one is ready to start. This causes the previous files to be destroyed. If I put a Thread.sleep(timeToSleep) in there then it works fine .... but very slowly. What is the proper way to handle this so that the code finishes processing one before moving on to the next?

    Java Code:
     input = "C:/pathToInput";	
    		File myDir = new File(input);
    		File[] files = myDir.listFiles();
    		
    		for(int i = 0; i < files.length; i++) {
    			output = "C:/pathToOutput/user"+(i+1)+".txt";
    			FileWriter w = new FileWriter(output);
    			BufferedWriter out = new BufferedWriter(w);
    			FileInputStream fstream = new FileInputStream(files[i]);
    			DataInputStream in = new DataInputStream(fstream);
    			BufferedReader br = new BufferedReader(new InputStreamReader(in));
    			
    			row = br.readLine();
    			do stuff ...
    			out.write(foobar);
    			br.close();
    			out.close();
    		}

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,002
    Rep Power
    20

    Default Re: FileWriter error

    There's something else going on other than the code you've posted.
    I do note you have no exception handling in there...

  3. #3
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default Re: FileWriter error

    Here is the entire code. As I said, I put the Thread.sleep() in there and it seemed to work fine but very slowly because of the pause each iteration. I let it run over night and came in this morning to happily see all the output files written to the directory (even opened some of them to make sure they had written correctly). Then, I changed directory (which for some reason was very slow also) and changed back. When I came back, lo and behold, only one of the files was still there. It just deleted all the rest of them. I am utterly confused ...

    Java Code:
    public void removeXML() throws IOException, InterruptedException {
    		int j;
    		String row, post;
    		String[] posts;
    		String input, output;
    		
    		input = "C:/pathToInput/";	
    		File myDir = new File(input);
    		File[] files = myDir.listFiles();
    		output = "C:/pathToOutput/";
    		
    		for(int i = 0; i < files.length; i++) {
    			FileWriter w = new FileWriter(output+"user"+(i+1)+".txt");
    			BufferedWriter out = new BufferedWriter(w);
    			FileInputStream fstream = new FileInputStream(files[i]);
    			DataInputStream in = new DataInputStream(fstream);
    			BufferedReader br = new BufferedReader(new InputStreamReader(in));
    			br.readLine();	//skip line 1
    			br.readLine();	//skip line 2
    			row = br.readLine();	//all posts
    			posts = row.split("<body>");
    			for(int k = 1; k < posts.length; k++) {
    				j = 0;
    				post = "";
    				while(posts[k].charAt(j) != '<') {
    					post = post + posts[k].charAt(j);
    					j++;
    				}
    				out.write(post+"\r\n");
    			}
    			br.close();
    			out.close();
    			Thread.sleep(500);
    		}
    	}

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: FileWriter error

    It just deleted all the rest of them
    Do you mean deleted the files or deleted the contents of the files?

    Where there any error messages on the console from the when the program executes?
    Where does the execution go if an exception is thrown? Does that code print/write out a message that you can see? It should write out an error message so you can find the problem and fix it.

  5. #5
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default Re: FileWriter error

    Quote Originally Posted by Norm View Post
    Do you mean deleted the files or deleted the contents of the files?

    Where there any error messages on the console from the when the program executes?
    Where does the execution go if an exception is thrown? Does that code print/write out a message that you can see? It should write out an error message so you can find the problem and fix it.
    It deleted the actual files (except the very first one is still there). There were no error messages during execution. The program seemed to run fine and all of the files were in the output directory after the program finished executing until I changed directory and came back.

    Without the Thread.sleep() in there, what seems to happen is that it writes a few files then deletes them, writes a few more, etc ...
    Last edited by kthomp271828; 11-29-2011 at 04:56 PM.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: FileWriter error

    The code you posted doesn't have any methods to delete files. Is there logic elsewhere in your code that does a delete?

    When I ran a simple test with the code you posted, it created a file (I had one file in the input folder) but did not write any data in it.

    The code as posted seems to do what it looks like it should do. Copy that code to a small simple program and execute it. Have no other logic in the program except what is shown in your post.
    Use a small number of input files for testing.

    Either your testing is incomplete or your observations of what the code does needs careful examination.

  7. #7
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default Re: FileWriter error

    Quote Originally Posted by Norm View Post
    The code you posted doesn't have any methods to delete files. Is there logic elsewhere in your code that does a delete?
    Actually, this is the whole program ... no other logic in the code. This is the main method (the constructor doesn't do anything):

    Java Code:
    public static void main(String[] args) throws IOException, InterruptedException {
    		
    		Extractor myExtractor = new Extractor();
    		myExtractor.removeXML();
    }
    I just now let it produce a few output files (about 20 whereas, in the end, there are over 20,000). It wrote the 20 files. I opened them and verified that they wrote correctly. I went up a level in the directory, came back and only the first file was still there. :(
    I am at a loss.
    Last edited by kthomp271828; 11-29-2011 at 05:09 PM.

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: FileWriter error

    Actually, this is the whole program
    Sorry your posted code is missing the imports, the class definition and the main method.

    I went up a level in the directory, came back and only the first file was still there.
    What OS are you on? What other programs do you have running that can delete files when you are not looking?
    Where is your little brother when this happens?

    If you are viewing 20 files in a directory, change up a directory level and then come back to the same directory, I don't know how any of the files can be deleted unless there is a program executing that deletes them.

    Can you capture this on a command prompt window and copy and paste it here so we can see the evidence?

  9. #9
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default Re: FileWriter error

    Haha, I wish it was just a little brother messing with me because then I could fix it. I just now went back and edited the previous post with the main method. Here is the whole thing:

    Java Code:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.BufferedWriter;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileWriter;
    import java.util.StringTokenizer; 
    
    public class Extractor() {
    
         public void removeXML() throws IOException, InterruptedException {
              //see code above
         }
         public static void main(String[] args) throws IOException, InterruptedException {
             
               Extractor myExtractor = new Extractor();
               myExtractor.removeXML();
         }
    }
    I am running Windows 7, but not running any other code ...
    Last edited by kthomp271828; 11-29-2011 at 05:32 PM.

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: FileWriter error

    Some things I see in your code that seem unusual:
    the files must have at least three lines in them, only the third line is processed by the code, the fourth and following lines are not read.
    If the third line is not properly configured, nothing is written to the output file.


    The code you posted is NOT the whole thing.
    Where is the Extractor class defined?

    YOU ARE NOT EXECUTING THE METHOD YOU SHOW. You are executing code from another class!!!
    Last edited by Norm; 11-29-2011 at 05:30 PM.

  11. #11
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default Re: FileWriter error

    Oh sorry for the confusion ... I was changing the names to protect the innocent. This is the "Extractor" class ... I just forgot to take that extra word out of the class name before I posted it. :)
    As for the file peculiarities, you are correct ... all of the file formats are homogeneous with exactly 3 lines. The only content that needs to extracted is in the third line.

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: FileWriter error

    I can't see any problems with the code you are posting.
    I just forgot
    What else have you forgotten to say about your problem? I lose interest when this happens.

    Can you capture what happens on a command prompt window and copy and paste it here so we can see the evidence?

  13. #13
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default Re: FileWriter error

    Oh, it just became more interesting ... from the command prompt, I listed the files in the directory and it says they are all there. I was even able to open them from the command prompt. I went back to the Windows folder and it only showed the first file still. There were no hidden files or anything like that. It's weird ... but at least I know the files are there. I guess that solves it.

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: FileWriter error

    Can you capture what happens on a command prompt window and copy and paste it here so we can see the evidence?

    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  15. #15
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default Re: FileWriter error

    Java Code:
    C:\pathToOuput>ls
    
    ... lots of user files
    user9997.txt
    user9998.txt
    user9999.txt
    
    C:\pathToOutput>
    After seeing this, I went back to the Windows folder and changed the "Arrange by" option then changed it back again (so it's the same as when I started). After that (oddly enough) all the files showed up in the Windows folder. Interestingly though, I went to another folder and came back again only to find that it once again is only listing the first file. So, it the end, it seems to be a Windows oddity and not a Java issue. Oh well, at least I know the files are there and I am able to access them. :) Thanks for your help.

  16. #16
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: FileWriter error

    Can you show the complete console for all your observations or is there a problem?
    Your 8 line posting of the console is useless.
    This is what I am looking for:

    Microsoft Windows XP [Version 5.1.2600]

    D:\JavaDevelopment\Testing\ForumQuestions7>dir *.html
    Volume in drive D is Work
    Volume Serial Number is 0C24-B38C

    Directory of D:\JavaDevelopment\Testing\ForumQuestions7

    11/24/2011 10:49 AM 794 TestingAppletHTML.html
    1 File(s) 794 bytes
    0 Dir(s) 7,106,326,528 bytes free

    D:\JavaDevelopment\Testing\ForumQuestions7>cd images

    D:\JavaDevelopment\Testing\ForumQuestions7\images> dir
    Volume in drive D is Work
    Volume Serial Number is 0C24-B38C

    Directory of D:\JavaDevelopment\Testing\ForumQuestions7\images

    11/27/2011 11:49 AM <DIR> .
    11/27/2011 11:49 AM <DIR> ..
    04/14/2000 08:22 AM 19,189 AppletImg.jpg
    09/17/1999 11:30 AM 76,756 ApproachToProperty.jpg
    10/07/1998 04:20 PM 67,982 AreWeFriends.jpg
    08/02/2010 09:33 AM 33,301 background.png
    05/21/2011 08:40 AM 871 Blob1.GIF
    07/17/2011 11:40 AM 1,151 BlueCar.png
    12/12/1998 10:38 AM 859 c.gif
    09/30/2005 06:42 PM 80 c12.gif
    09/20/2011 10:45 AM 2,790 cell.png
    11/26/2011 09:52 PM 22,846 ChessBoard.jpg
    06/12/2011 02:47 PM 921 ColorBand.png
    10/05/1997 11:35 PM 4,584 CoreJava1.1.gif
    10/09/1997 10:05 PM 26,849 Core_Java.gif
    10/09/1997 10:05 PM 28,038 Core_Java_rotated.gif
    09/20/2011 10:56 AM 2,799 dCell.png
    07/03/1997 02:49 PM 1,929 duke.gif
    06/03/2011 11:35 AM 1,638 dukeWaveRed.gif
    01/24/2000 05:29 PM 1,287 extendingTrail.gif
    09/07/2004 01:57 PM 2,238 favicon.ico
    09/23/2003 01:39 PM 48,961 foxtrot.jpg
    07/17/2011 11:40 AM 1,146 GreenCar.png
    10/09/1998 09:52 AM 66,336 JungleWalk.jpg
    07/27/2007 02:23 PM 172 left.gif
    07/27/2007 02:23 PM 235 middle.gif
    09/23/2011 03:51 PM 2,790 nAlive.png
    09/23/2011 03:50 PM 2,790 nDead.png
    12/25/2001 09:33 AM 1,996 OneHundredBy.jpg
    06/03/2011 11:35 AM 8,613 Pig.gif
    07/17/2011 11:40 AM 1,137 RedCar.png
    07/27/2007 02:23 PM 172 right.gif
    11/08/2011 02:34 PM <DIR> shapes
    06/19/2011 04:39 PM 16,117 shapes.zip
    12/03/2001 08:56 AM 287 ShortLeftArrow.gif
    12/03/2001 08:54 AM 287 ShortRightArrow.gif
    12/03/2001 08:54 AM 215 ShortUpArrow.gif
    11/25/2011 10:08 PM 2,295 Smily.jpg
    06/03/2011 11:35 AM 248 sound.gif
    07/17/2011 11:34 AM 11,233 Track.jpg
    01/01/1980 12:00 AM 2,003,840 TwoMeg.jpg
    06/29/2001 06:37 PM 27,959 worcester.jpg
    39 File(s) 2,492,937 bytes
    3 Dir(s) 7,106,326,528 bytes free

    D:\JavaDevelopment\Testing\ForumQuestions7\images> cd ..

    D:\JavaDevelopment\Testing\ForumQuestions7>dir *.html
    Volume in drive D is Work
    Volume Serial Number is 0C24-B38C

    Directory of D:\JavaDevelopment\Testing\ForumQuestions7

    11/24/2011 10:49 AM 794 TestingAppletHTML.html
    1 File(s) 794 bytes
    0 Dir(s) 7,106,326,528 bytes free

    D:\JavaDevelopment\Testing\ForumQuestions7>

  17. #17
    kthomp271828 is offline Member
    Join Date
    Aug 2011
    Posts
    17
    Rep Power
    0

    Default Re: FileWriter error

    I used ls so it didn't give that info. Here it is with dir ...

    Java Code:
    ... lots of user listings
    11/29/2011  02:30 AM             3,865 user9732.txt
    11/29/2011  02:30 AM             4,775 user9733.txt
    11/29/2011  02:30 AM             6,314 user9734.txt
    11/29/2011  02:30 AM             4,084 user9735.txt
    11/29/2011  02:30 AM             8,236 user9736.txt
    11/29/2011  02:30 AM             2,345 user9737.txt
    11/29/2011  02:30 AM               169 user9738.txt
    11/29/2011  02:30 AM             3,384 user9739.txt
    11/29/2011  01:12 AM             1,645 user974.txt
    11/29/2011  02:30 AM             3,665 user9740.txt
    11/29/2011  02:30 AM             3,354 user9741.txt
    11/29/2011  02:30 AM             1,455 user9742.txt
    11/29/2011  02:30 AM             3,718 user9743.txt
    11/29/2011  02:30 AM             1,494 user9744.txt
    11/29/2011  02:30 AM             2,434 user9745.txt
    11/29/2011  02:30 AM             1,998 user9746.txt
    11/29/2011  02:30 AM             1,854 user9747.txt
    11/29/2011  02:30 AM             2,234 user9748.txt
    11/29/2011  02:30 AM             1,577 user9749.txt
    11/29/2011  01:12 AM             4,203 user975.txt
    11/29/2011  02:30 AM             1,423 user9750.txt
    11/29/2011  02:30 AM             1,679 user9751.txt
    11/29/2011  02:30 AM             4,202 user9752.txt
    11/29/2011  02:30 AM             1,129 user9753.txt
    11/29/2011  02:30 AM            13,750 user9754.txt
    11/29/2011  02:30 AM             1,314 user9755.txt
    11/29/2011  02:30 AM             5,994 user9756.txt
    11/29/2011  02:30 AM             2,473 user9757.txt
    11/29/2011  02:30 AM             5,020 user9758.txt
    11/29/2011  02:30 AM             4,075 user9759.txt
    11/29/2011  01:12 AM             2,044 user976.txt
    11/29/2011  02:30 AM             1,687 user9760.txt
    11/29/2011  02:30 AM             8,452 user9761.txt
    11/29/2011  02:30 AM             2,386 user9762.txt
    11/29/2011  02:30 AM             2,231 user9763.txt
    11/29/2011  02:30 AM             3,671 user9764.txt
    11/29/2011  02:30 AM             2,003 user9765.txt
    11/29/2011  02:30 AM             3,152 user9766.txt
    11/29/2011  02:30 AM             1,838 user9767.txt
    11/29/2011  02:30 AM            19,025 user9768.txt
    11/29/2011  02:30 AM             1,451 user9769.txt
    11/29/2011  01:12 AM             1,461 user977.txt
    11/29/2011  02:30 AM             1,484 user9770.txt
    11/29/2011  02:30 AM             2,527 user9771.txt
    11/29/2011  02:30 AM             2,298 user9772.txt
    11/29/2011  02:30 AM               689 user9773.txt
    11/29/2011  02:30 AM             5,281 user9774.txt
    11/29/2011  02:30 AM             3,219 user9775.txt
    11/29/2011  02:30 AM             5,405 user9776.txt
    11/29/2011  02:30 AM             1,631 user9777.txt
    11/29/2011  02:30 AM             2,467 user9778.txt
    11/29/2011  02:30 AM             1,347 user9779.txt
    11/29/2011  01:12 AM             4,114 user978.txt
    11/29/2011  02:30 AM             1,743 user9780.txt
    11/29/2011  02:30 AM             1,395 user9781.txt
    11/29/2011  02:30 AM             5,857 user9782.txt
    11/29/2011  02:30 AM             2,162 user9783.txt
    11/29/2011  02:30 AM             1,794 user9784.txt
    11/29/2011  02:30 AM             4,209 user9785.txt
    11/29/2011  02:30 AM             5,922 user9786.txt
    11/29/2011  02:30 AM             2,673 user9787.txt
    11/29/2011  02:30 AM             1,537 user9788.txt
    11/29/2011  02:30 AM             6,728 user9789.txt
    11/29/2011  01:12 AM             6,268 user979.txt
    11/29/2011  02:30 AM               598 user9790.txt
    11/29/2011  02:31 AM            15,525 user9791.txt
    11/29/2011  02:31 AM             2,829 user9792.txt
    11/29/2011  02:31 AM             2,296 user9793.txt
    11/29/2011  02:31 AM             2,675 user9794.txt
    11/29/2011  02:31 AM             1,074 user9795.txt
    11/29/2011  02:31 AM             2,792 user9796.txt
    11/29/2011  02:31 AM               621 user9797.txt
    11/29/2011  02:31 AM             3,398 user9798.txt
    11/29/2011  02:31 AM               615 user9799.txt
    11/29/2011  11:22 AM             1,560 user98.txt
    11/29/2011  01:12 AM             1,357 user980.txt
    11/29/2011  02:31 AM               645 user9800.txt
    11/29/2011  02:31 AM               981 user9801.txt
    11/29/2011  02:31 AM             4,037 user9802.txt
    11/29/2011  02:31 AM             1,292 user9803.txt
    11/29/2011  02:31 AM             2,069 user9804.txt
    11/29/2011  02:31 AM             1,688 user9805.txt
    11/29/2011  02:31 AM               985 user9806.txt
    11/29/2011  02:31 AM               837 user9807.txt
    11/29/2011  02:31 AM             1,687 user9808.txt
    11/29/2011  02:31 AM             2,040 user9809.txt
    11/29/2011  01:12 AM             1,168 user981.txt
    11/29/2011  02:31 AM            14,082 user9810.txt
    11/29/2011  02:31 AM             2,066 user9811.txt
    11/29/2011  02:31 AM             1,489 user9812.txt
    11/29/2011  02:31 AM             2,889 user9813.txt
    11/29/2011  02:31 AM             2,748 user9814.txt
    11/29/2011  02:31 AM               411 user9815.txt
    11/29/2011  02:31 AM             2,722 user9816.txt
    11/29/2011  02:31 AM             2,599 user9817.txt
    11/29/2011  02:31 AM             1,117 user9818.txt
    11/29/2011  02:31 AM             1,602 user9819.txt
    11/29/2011  01:12 AM               673 user982.txt
    11/29/2011  02:31 AM               706 user9820.txt
    11/29/2011  02:31 AM             2,136 user9821.txt
    11/29/2011  02:31 AM             1,137 user9822.txt
    11/29/2011  02:31 AM             1,259 user9823.txt
    11/29/2011  02:31 AM               919 user9824.txt
    11/29/2011  02:31 AM             3,472 user9825.txt
    11/29/2011  02:31 AM             5,082 user9826.txt
    11/29/2011  02:31 AM             1,200 user9827.txt
    11/29/2011  02:31 AM             2,909 user9828.txt
    11/29/2011  02:31 AM             3,119 user9829.txt
    11/29/2011  01:12 AM             4,152 user983.txt
    11/29/2011  02:31 AM             1,505 user9830.txt
    11/29/2011  02:31 AM             3,953 user9831.txt
    11/29/2011  02:31 AM             4,947 user9832.txt
    11/29/2011  02:31 AM             6,617 user9833.txt
    11/29/2011  02:31 AM             2,004 user9834.txt
    11/29/2011  02:31 AM             6,819 user9835.txt
    11/29/2011  02:31 AM             2,291 user9836.txt
    11/29/2011  02:31 AM             2,569 user9837.txt
    11/29/2011  02:31 AM               811 user9838.txt
    11/29/2011  02:31 AM             1,811 user9839.txt
    11/29/2011  01:12 AM             3,299 user984.txt
    11/29/2011  02:31 AM             4,759 user9840.txt
    11/29/2011  02:31 AM             4,065 user9841.txt
    11/29/2011  02:31 AM             2,022 user9842.txt
    11/29/2011  02:31 AM             1,328 user9843.txt
    11/29/2011  02:31 AM             1,445 user9844.txt
    11/29/2011  02:31 AM             2,958 user9845.txt
    11/29/2011  02:31 AM             1,969 user9846.txt
    11/29/2011  02:31 AM               324 user9847.txt
    11/29/2011  02:31 AM             3,730 user9848.txt
    11/29/2011  02:31 AM             3,596 user9849.txt
    11/29/2011  01:12 AM             1,411 user985.txt
    11/29/2011  02:31 AM             1,197 user9850.txt
    11/29/2011  02:31 AM             1,139 user9851.txt
    11/29/2011  02:31 AM             3,973 user9852.txt
    11/29/2011  02:31 AM             1,575 user9853.txt
    11/29/2011  02:31 AM             3,820 user9854.txt
    11/29/2011  02:31 AM             2,653 user9855.txt
    11/29/2011  02:31 AM             3,883 user9856.txt
    11/29/2011  02:31 AM             1,399 user9857.txt
    11/29/2011  02:31 AM             4,220 user9858.txt
    11/29/2011  02:31 AM             2,987 user9859.txt
    11/29/2011  01:12 AM             3,611 user986.txt
    11/29/2011  02:31 AM             1,060 user9860.txt
    11/29/2011  02:31 AM             2,434 user9861.txt
    11/29/2011  02:31 AM             4,133 user9862.txt
    11/29/2011  02:31 AM             1,017 user9863.txt
    11/29/2011  02:31 AM             1,973 user9864.txt
    11/29/2011  02:31 AM             1,441 user9865.txt
    11/29/2011  02:31 AM             1,260 user9866.txt
    11/29/2011  02:31 AM             1,533 user9867.txt
    11/29/2011  02:31 AM             3,703 user9868.txt
    11/29/2011  02:31 AM             3,428 user9869.txt
    11/29/2011  01:12 AM             1,371 user987.txt
    11/29/2011  02:31 AM             2,747 user9870.txt
    11/29/2011  02:31 AM             2,737 user9871.txt
    11/29/2011  02:31 AM             1,583 user9872.txt
    11/29/2011  02:31 AM             1,685 user9873.txt
    11/29/2011  02:31 AM             6,063 user9874.txt
    11/29/2011  02:31 AM             3,612 user9875.txt
    11/29/2011  02:31 AM             6,841 user9876.txt
    11/29/2011  02:31 AM               750 user9877.txt
    11/29/2011  02:31 AM             5,845 user9878.txt
    11/29/2011  02:31 AM             1,219 user9879.txt
    11/29/2011  01:12 AM               898 user988.txt
    11/29/2011  02:31 AM             1,324 user9880.txt
    11/29/2011  02:31 AM             6,617 user9881.txt
    11/29/2011  02:31 AM             1,376 user9882.txt
    11/29/2011  02:31 AM             3,194 user9883.txt
    11/29/2011  02:31 AM             1,470 user9884.txt
    11/29/2011  02:31 AM             1,269 user9885.txt
    11/29/2011  02:31 AM             2,989 user9886.txt
    11/29/2011  02:31 AM             3,206 user9887.txt
    11/29/2011  02:31 AM             2,578 user9888.txt
    11/29/2011  02:31 AM             1,149 user9889.txt
    11/29/2011  01:12 AM             1,351 user989.txt
    11/29/2011  02:31 AM             3,839 user9890.txt
    11/29/2011  02:31 AM             1,211 user9891.txt
    11/29/2011  02:31 AM             2,291 user9892.txt
    11/29/2011  02:31 AM             1,510 user9893.txt
    11/29/2011  02:31 AM             1,333 user9894.txt
    11/29/2011  02:31 AM             3,213 user9895.txt
    11/29/2011  02:31 AM             1,817 user9896.txt
    11/29/2011  02:31 AM             4,135 user9897.txt
    11/29/2011  02:31 AM               412 user9898.txt
    11/29/2011  02:31 AM             1,268 user9899.txt
    11/29/2011  11:22 AM             2,681 user99.txt
    11/29/2011  01:12 AM             3,442 user990.txt
    11/29/2011  02:31 AM             1,061 user9900.txt
    11/29/2011  02:31 AM             4,588 user9901.txt
    11/29/2011  02:32 AM               697 user9902.txt
    11/29/2011  02:32 AM            10,176 user9903.txt
    11/29/2011  02:32 AM             2,977 user9904.txt
    11/29/2011  02:32 AM             1,997 user9905.txt
    11/29/2011  02:32 AM             4,290 user9906.txt
    11/29/2011  02:32 AM             3,462 user9907.txt
    11/29/2011  02:32 AM             1,104 user9908.txt
    11/29/2011  02:32 AM             2,713 user9909.txt
    11/29/2011  01:12 AM             3,768 user991.txt
    11/29/2011  02:32 AM             1,482 user9910.txt
    11/29/2011  02:32 AM             3,254 user9911.txt
    11/29/2011  02:32 AM             3,248 user9912.txt
    11/29/2011  02:32 AM               556 user9913.txt
    11/29/2011  02:32 AM             3,111 user9914.txt
    11/29/2011  02:32 AM            12,992 user9915.txt
    11/29/2011  02:32 AM             2,421 user9916.txt
    11/29/2011  02:32 AM             2,421 user9917.txt
    11/29/2011  02:32 AM             1,138 user9918.txt
    11/29/2011  02:32 AM               735 user9919.txt
    11/29/2011  01:12 AM               509 user992.txt
    11/29/2011  02:32 AM             1,659 user9920.txt
    11/29/2011  02:32 AM             1,710 user9921.txt
    11/29/2011  02:32 AM             5,613 user9922.txt
    11/29/2011  02:32 AM             4,846 user9923.txt
    11/29/2011  02:32 AM             2,374 user9924.txt
    11/29/2011  02:32 AM             1,721 user9925.txt
    11/29/2011  02:32 AM             1,150 user9926.txt
    11/29/2011  02:32 AM             1,241 user9927.txt
    11/29/2011  02:32 AM             2,392 user9928.txt
    11/29/2011  02:32 AM             4,550 user9929.txt
    11/29/2011  01:13 AM             7,327 user993.txt
    11/29/2011  02:32 AM             1,763 user9930.txt
    11/29/2011  02:32 AM             2,776 user9931.txt
    11/29/2011  02:32 AM             1,900 user9932.txt
    11/29/2011  02:32 AM             4,517 user9933.txt
    11/29/2011  02:32 AM               812 user9934.txt
    11/29/2011  02:32 AM               573 user9935.txt
    11/29/2011  02:32 AM             2,635 user9936.txt
    11/29/2011  02:32 AM             3,545 user9937.txt
    11/29/2011  02:32 AM             4,526 user9938.txt
    11/29/2011  02:32 AM             3,628 user9939.txt
    11/29/2011  01:13 AM             1,223 user994.txt
    11/29/2011  02:32 AM             2,921 user9940.txt
    11/29/2011  02:32 AM               968 user9941.txt
    11/29/2011  02:32 AM             3,586 user9942.txt
    11/29/2011  02:32 AM             1,791 user9943.txt
    11/29/2011  02:32 AM             1,421 user9944.txt
    11/29/2011  02:32 AM             3,215 user9945.txt
    11/29/2011  02:32 AM               253 user9946.txt
    11/29/2011  02:32 AM             3,550 user9947.txt
    11/29/2011  02:32 AM               981 user9948.txt
    11/29/2011  02:32 AM            10,861 user9949.txt
    11/29/2011  01:13 AM             4,499 user995.txt
    11/29/2011  02:32 AM             1,637 user9950.txt
    11/29/2011  02:32 AM             1,065 user9951.txt
    11/29/2011  02:32 AM             4,757 user9952.txt
    11/29/2011  02:32 AM             1,377 user9953.txt
    11/29/2011  02:32 AM             2,738 user9954.txt
    11/29/2011  02:32 AM             9,281 user9955.txt
    11/29/2011  02:32 AM             7,039 user9956.txt
    11/29/2011  02:32 AM             1,332 user9957.txt
    11/29/2011  02:32 AM             2,285 user9958.txt
    11/29/2011  02:32 AM             6,074 user9959.txt
    11/29/2011  01:13 AM             2,769 user996.txt
    11/29/2011  02:32 AM             3,760 user9960.txt
    11/29/2011  02:32 AM             3,708 user9961.txt
    11/29/2011  02:32 AM             1,206 user9962.txt
    11/29/2011  02:32 AM             1,895 user9963.txt
    11/29/2011  02:32 AM             3,435 user9964.txt
    11/29/2011  02:32 AM               904 user9965.txt
    11/29/2011  02:32 AM             1,137 user9966.txt
    11/29/2011  02:32 AM             7,100 user9967.txt
    11/29/2011  02:32 AM             1,480 user9968.txt
    11/29/2011  02:32 AM             4,429 user9969.txt
    11/29/2011  01:13 AM             2,724 user997.txt
    11/29/2011  02:32 AM             1,492 user9970.txt
    11/29/2011  02:32 AM             3,211 user9971.txt
    11/29/2011  02:32 AM             1,915 user9972.txt
    11/29/2011  02:32 AM             1,144 user9973.txt
    11/29/2011  02:32 AM             3,711 user9974.txt
    11/29/2011  02:32 AM             2,697 user9975.txt
    11/29/2011  02:32 AM             8,817 user9976.txt
    11/29/2011  02:32 AM             1,469 user9977.txt
    11/29/2011  02:32 AM             2,095 user9978.txt
    11/29/2011  02:32 AM               547 user9979.txt
    11/29/2011  01:13 AM             6,695 user998.txt
    11/29/2011  02:32 AM               680 user9980.txt
    11/29/2011  02:32 AM             1,510 user9981.txt
    11/29/2011  02:32 AM             2,158 user9982.txt
    11/29/2011  02:32 AM             2,149 user9983.txt
    11/29/2011  02:32 AM             4,268 user9984.txt
    11/29/2011  02:32 AM             1,481 user9985.txt
    11/29/2011  02:32 AM             3,080 user9986.txt
    11/29/2011  02:32 AM             1,307 user9987.txt
    11/29/2011  02:32 AM             1,626 user9988.txt
    11/29/2011  02:32 AM            14,665 user9989.txt
    11/29/2011  01:13 AM             2,187 user999.txt
    11/29/2011  02:32 AM             4,488 user9990.txt
    11/29/2011  02:32 AM             7,885 user9991.txt
    11/29/2011  02:32 AM            11,478 user9992.txt
    11/29/2011  02:32 AM             1,193 user9993.txt
    11/29/2011  02:32 AM             5,527 user9994.txt
    11/29/2011  02:32 AM             2,613 user9995.txt
    11/29/2011  02:32 AM             5,017 user9996.txt
    11/29/2011  02:32 AM             1,933 user9997.txt
    11/29/2011  02:32 AM               656 user9998.txt
    11/29/2011  02:32 AM             1,547 user9999.txt
               27139 File(s)     75,252,654 bytes
                   2 Dir(s)  111,811,145,728 bytes free
    
    C:\pathToOutput>
    One thing I notice is that there should be 27135 user files. I have no idea what those extra 4 files are. I am going to rewrite the code to specify the path to the input rather than use myDir.listFiles().

  18. #18
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default Re: FileWriter error

    I guess you can handle the rest of it now.

Similar Threads

  1. Initializing FileWriter
    By loopsnhoops in forum Advanced Java
    Replies: 1
    Last Post: 05-31-2011, 02:28 AM
  2. FileWriter error
    By bczm8703 in forum JCreator
    Replies: 0
    Last Post: 03-04-2011, 04:10 AM
  3. New line in FileWriter
    By luc@$ in forum New To Java
    Replies: 3
    Last Post: 01-31-2011, 04:45 AM
  4. BufferedWriter, FileWriter
    By ladykrimson in forum New To Java
    Replies: 4
    Last Post: 12-06-2010, 02:35 AM
  5. JAva Filewriter
    By tommyyyy in forum New To Java
    Replies: 1
    Last Post: 03-28-2009, 12:51 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •