The Artima Developer Community
Sponsored Link

Java Answers Forum
sorting files according to the date in there filename

1 reply on 1 page. Most recent reply: Aug 20, 2004 9:02 PM by Senthoorkumaran Punniamoorthy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
jollyboy

Posts: 1
Nickname: jollyboy
Registered: Aug, 2004

sorting files according to the date in there filename Posted: Aug 14, 2004 6:42 AM
Reply to this message Reply
Advertisement
hello experts,

i am facing some difficulty in sorting the files.
that is i am having files(with datecoulmn in it) in folder.(ex: 01022004datafile.dat).
i want to take the files in the sorting order of the date in the respective filenames.
i am trying with tree map(since for one date more than one file could be there)....how to solve this issue.....
for example

c:\allfiles is the folder
in that
01022004datafile.dat
01022004comfile.dat
02022004datafile.dat
03042004datafile .dat
31012004datafile.dat
31012004comfile.dat

are the files are there
i need for this date these many files are there and in sorted order of date(i.e)
31/01/2004
31012004datafile.dat
31012004comfile.dat
01/02/2004
01022004datafile.dat
01022004comfile.dat
02/02/2004
02022004datafile.dat
03/04/2004
03042004datafile.dat

i am trying with the tree and i am using filename as key and date value as value(since the dates are duplicate it is not allowing me to take it as key).But i cant able to sort according to date values.since the tree can be sorted according to keys not values.......................any solutions is there for this
or in what way we can solve this issue easily........

thankx in advance

punith


Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: sorting files according to the date in there filename Posted: Aug 20, 2004 9:02 PM
Reply to this message Reply
Use a TreeMap and date value as the Key and the in the value column have a ArrayList which store all the file names for that date. That should solve your problem I guess

Flat View: This topic has 1 reply on 1 page
Topic: disabling the keyevents Previous Topic   Next Topic Topic: How to activate Hyperlink to Jtable cell?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use