Hi All,

i am here with a problem in file handling in java.

i need to search all the files on system with extention *.fdr. which are not less den one day old.
then i need to convert the selected file to csv which is perfomed by a command in dos(symanalyzer).
then i need to attach the csv file to mail .

can someone help me with the java code .

i have done some R&D and found that i can use the method "lastModified()".

Thanks and Regards
Mukul

Recommended Answers

All 3 Replies

you'll need a little bit more than just one method.
what have you got so far, and what are you stuck with?

                                final String dosCommand = "cmd /c REN *docx  *txt /s ";
                                final String location = "D:\\test";
          try {
                                final Process process =  Runtime.getRuntime().exec(
                                        dosCommand + " " + location);
                                final InputStream in = process.getInputStream();
                                int ch;
                                    while((ch = in.read()) != -1)
                                    {
                                            System.out.print((char)ch);
                                    }
           } catch (IOException e)
                {
                      // e.printStackTrace();
                       System.out.println("exceptionm");
                }

i am done with the first req i.e. i found out the files with curent date modifed .
now i want to use those files in batch command.
i have tried the above for executing batch command but i cant get any output from this.
instead of Ren command DIR command is working .

Do anyone have idea how to execute batch command in java.

Thanks
Mukul

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.