This discussion is archived
3 Replies Latest reply: Aug 21, 2009 12:22 AM by 549379 RSS

how to list sorted files in a folder?

549379 Newbie
Currently Being Moderated
I am in need of creating a java program which should perform the following.

1. Read ALL the files located under c:\main dir
2. Append the read files into a Email.log file in the order in which the files are created.

For example: main directory has three files. A.txt(created on Aug1st2009,10:00AM), B.txt(created on Aug1st2009,10:01AM),C.txt(created on Aug1st2009,10:02AM)

Email.log file should contain the contents of A.txt then B.txt then C.txt. The contents of old file should appear in the top and the content of latest file(C.txt) shouled appeared in the bottom of Email.log file.

Hope you understand my requirements. could you help me out in starting with sample code?