File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Fetching Files with filename Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Fetching Files with filename" Watch "Fetching Files with filename" New topic

Fetching Files with filename

sk mehrotra
Ranch Hand

Joined: Oct 27, 2005
Posts: 34
How can i fetch the files from a directory on its name on the user parameter, i.e on the Date as if the user specify date then files should be displayed between 01_05_2009 to 03_05_2009
Eg: filename_01_05_2009.txt, filename_02_05_2009.txt, filename_03_05_2009.txt, filename_04_05_2009.txt.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20202

Use a SimpleDateFormat to parse your file names into Date objects:
The quotes enable you to add "filename" and ".txt" as literal text.

How To Ask Questions How To Answer Questions
sk mehrotra
Ranch Hand

Joined: Oct 27, 2005
Posts: 34
I need to get the files on the date and name of the file, i.e
If filename is like ABCD_1111_2222_10-MAR-2008.txt in this case we'll be knowing the "ABCD" and ""10-MAR-2009" and secondly we need to search the files on the date range provide through the parameters, i.e
if user provide the date range between 10-mar-2009 and 15-mare-2009, then search of files would be between 10-mar-2009 to 15-mar-2009, i.e file would be between ABCD_1111_2222_10-MAR-2008.txt to ABCD_1111_2222_15-MAR-2008.txt.
I agree. Here's the link:
subject: Fetching Files with filename
jQuery in Action, 3rd edition