-
Reading files with changing names
every few hours my AS400 generates a text fille with the following naming convention:
"IR + 6 digit number which incriments by one each time a file is generated + _ + The start date and time for the file +_to_ + end date and time for the file + .txt". For example IR000002_20070528141515_to_20070528170003.txt is the name of the second file generated which started at 14:15:15 on 28/05/2007 and ended at 17:00:03 on 28/05/2007.
I want my Java program to read each file generated. I know how to do this when the file generaed is the same each time but havnt a clue now that each file has a different name. Can anybody help?
-
I interpret your question as containing the supposition that you are processing your files programmatically, rather than through user action on a JFileChooser.
You can use the list() method of File with a class which implements the FileFilter interface whose accept() method filters for the file names which meet your criterion, adding each filtered file name into a vector(or Set?) of strings. Then process your files by iterating through the vector of file names. An appropriate filter might be s.startsWith("IR").
-
Yes. I intend for my program to run automatically. Each time it does it will find the latest text file that has been generated and convert it to XML.
Similar Threads
-
By Neville in forum VB Classic
Replies: 1
Last Post: 05-24-2001, 11:51 AM
-
By Jeff in forum VB Classic
Replies: 7
Last Post: 03-30-2001, 08:15 PM
-
Replies: 4
Last Post: 09-27-2000, 05:09 PM
-
By Ted Young in forum VB Classic
Replies: 1
Last Post: 08-15-2000, 10:17 AM
-
By Bill in forum VB Classic
Replies: 0
Last Post: 07-31-2000, 01:34 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks