Click here to Skip to main content
15,880,651 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Java
import java.io.*;
import java.io.FileReader;

public class rrr
{
    public static void main(String args[])throws IOException
    {
        String p="E:\\folderA";
       
   File dir=new File(p);
      File[]  files=dir.listFiles();
            for(File f : files)
              if(f.isFile())
                

           { 

              BufferedReader  ins=null;
             ins=new BufferedReader(new FileReader(f));
               String line;
             
             
                    
             System.out.print("[");
             System.out.print(f.getName());
             System.out.print("_DINAMALAR_DATE]\n");
            
    
           

                {
   while((line=ins.readLine())!=null)
                     {
                              System.out.println(line);
                     }
            
              
          }
     
           }}}
Posted
Updated 13-Dec-15 21:26pm
v3
Comments
Richard MacCutchan 11-Dec-15 8:24am    
What is your question?
TorstenH. 11-Dec-15 8:56am    
"Can someone please do my homework?"
Member 12200805 14-Dec-15 0:41am    
how to get the output in the excisting file itself?
Richard MacCutchan 14-Dec-15 3:09am    
What output, what file? Please edit your question and explain in proper detail what problem you are trying to solve.
Member 12200805 14-Dec-15 3:31am    
sir i have to read all files from the folder and should get the name of the file inside each file respectively...this changes(adding name of the file) should be directly go to the excisting file instead of displaying in the command prompt..

before running the file will have only contents..after running this program, the file should contain respective file name with content..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900