How to make FilenameFilter return filenames according to time

How do you get the list of filenames in a directory arranged according to the time modified, instead of listing in alphabetical order?
For example, I have:
FILENAME TIME
bfile.txt 08/30/2002 07:00
cfile.txt 08/30/2002 09:00
afile.txt 08/30/2002 10:00
The code I used is:
import java.io.*;
public class RetrieveFileList {
  public static void main(String args[]){
    File directory = new File("C:\\folders\\test\\");
    FNameFilter filter = new FNameFilter();
    String[] fileList = directory.list(filter);
    System.out.println("filelist count: "+fileList.length);
    for (int i=0; i<fileList.length ;i++){
      System.out.println(fileList);
class FNameFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
boolean bAccept = false;
if ( name.endsWith(".txt") )
bAccept = true;
return bAccept;
When I use FilenameFilter and File.list(), the result is:
afile.txt
bfile.txt
cfile.txt
What do you do so that the result will be like:
bfile.txt
cfile.txt
afile.txt

Instead of String[] fileList = directory.list(filter);use File[] files = directory.listFiles(filter);
Arrays.sort(files,
            new Comparator()
                    public int compare(Object o1, Object o2)
                        File f1 = (File)o1;
                        File f2 = (File)o2;
                        return f1.lastModified() - f2.lastModified();
String[] fileList = new String[files.length];
for (int ii = 0; ii < files.length; ii++)
    fileList[ii] = files[ii].getName();
Answer provided by Friends of the Water Cooler. Please inform forum admin via the
'Discuss the JDC Web Site' forum that off-topic threads should be supported.

Similar Messages

  • Search bar shows only icon. How to make it return to normal?

    Search bar shows only icon. How to make it return to normal?
    Normally, the search bar looks like the picture in this link.
    http://www.simplehelp.net/images/googlesearchicon/img03.jpg
    However, I only have the icon in front and no space to type the search information. How can this be solved?
    Is it because of any of my add-ons?

    Try:
    * http://kb.mozillazine.org/Corrupt_localstore.rdf
    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • In OSX 10.8, how can I make Spotlight  return filenames?

    Upto OSX 10.7, Spotlight always returned file names as well as content.
    Now, it only returns content, and I do not see any Preference option to make it return the filenames.

    But sometimes the file path appears, and sometimes it doesn't.
    Naturally, it's not showing for the file paths I need!
    When all that "appears" is a blank, any idea how to get Spotlight to show the file path?
    I've noticed that some are slow to load, sometimes.
    If you want to see the path so you can go to the folder, hold down the command key and click the item.
    Perhaps reindexing spotlight might help, but if it is finding the file, I'm not sure that would be the problem.

  • When the page will be load how to make the page blank in run time

    Dear
    when i will run the page the fields shoud come with blank Field.
    i want to make it in runtime.
    example- i have one page having employees data. but when i will run that page the data will not come only blank fields should come, after thar i will create.

    duplicate how to make the page blank field in runtime

  • How to make a return to main menu button

    I've only recently upgraded from iDVD (not sure how I worked with it for so long)
    I'm using DVD SP 3
    I have made a dvd with a title screen from where you can play the entire film or go to a second menu which contains four chapters.
    This seems very basic but i've searched the forum a lot and can't find the answer (maybe because it's so basic)...
    How do I make a button on the second/chapter menu screen that will return to the main menu? The kind that idvd places there automtically.
    Do I have to make a script (I haven't done this before) or is there some 'automatic' function or ?
    Ashley

    1) Create a button on the chapter menu with the text MAIN MENU (or whatever you want it to say).
    2) Select the chapter menu in either the graphical or outline view of your DVD.
    3) Click on the Connections tab.
    4) Select the MAIN MENU button in the source column.
    5) Select the main menu in the Targets column.
    6) Click the Connect button above the Targets column.
    After doing the above steps you should see the main menu in the Target column to the right of "MAIN MENU:Jump when activated" in the source column. Your MAIN MENU button will now take you back to the main menu.
    Message was edited by: John Link

  • How to make a "return delivery" from a goods mvnt  linked to a reservation

    Hi, I want to realize a "return delivery" from a goods mvnt that is linked to a reservation number.
    I'm using FM BAPI_GOODSMVT_CREATE.
    I'm able to create a goods mvnt, but this doesn't updates the quantity in the reservation document.
    For example:
    There are 10 units of a material reserved in a reservation document.
    I create a goods mov. linked to the reservation number by populating the field RESERV_NO and RES_ITEM in the GOODSMVT_ITEM parameter. In this document I fullfilled the TARGET_QTY field with 10. This the positive movement.
    After that, reservation document says that there are no units pending to serve. (10 reserved - 10 served = 0 pending).
    Now, I want to return 2 units of this material. I fullfilled the fields REF_DOC_YR, REF_DOC and REF_DOC_IT with keys (doc/item/year) of the first goods movement, and MOVE_TYPE with the reversal movement number. But this doesn't updates the quantity in the reservation document.
    I tried fullfiling RESERV_NO and RES_ITEM, but this generates a positive movement, not the reversal!
    Is there any other process that updates quantity in the reservation document?
    Could anybody help me?

    1) Create a button on the chapter menu with the text MAIN MENU (or whatever you want it to say).
    2) Select the chapter menu in either the graphical or outline view of your DVD.
    3) Click on the Connections tab.
    4) Select the MAIN MENU button in the source column.
    5) Select the main menu in the Targets column.
    6) Click the Connect button above the Targets column.
    After doing the above steps you should see the main menu in the Target column to the right of "MAIN MENU:Jump when activated" in the source column. Your MAIN MENU button will now take you back to the main menu.
    Message was edited by: John Link

  • Sales Order - How to make Delivery Date default to Lead Time?

    My scenario is this:
    - We have items that go thru several production stages before it is a finished item that can be sold.
    - Each production item has its lead time loaded.
    - I would like the delivery date of a finished item to equal the sum of the productions items lead times.
    I dont want my sales people to have to look at calendars are calculate how long until something is ready for delivery.
    I would like my sales orders delivery date to default to a date that sales people can use.
    Is this possible? I would think this would be part of core functionality but I do not see this.
    Thank you,
    John Sefton

    John,
    Knowing what Items are added to the Sales Order at the time of entry would not be possible without SDK since the line level details are stored internally in temp location.
    Only on Submitting the Sales Order would it be possible to calculate the date.
    Let me know how you would want to move on this
    Suda

  • How to make the opening video replay every time in ibooks author?

    I have opening media in my  ibook. But I need it to replay every time the ibooks is opened again. How do I do this? Any help would be appreciated.

    Are you saying export my processed video to .movs or DNxHD and give to him?  The terms are all new to me.  When I last edited with FCP it was with DVCam footage captured from the cassettes.  Would he be able to then import the audio from the SxS card and sync it on his time line with those kind of files?
    Nothing was deleted....straight 1 hr 2 minute single take.... broken down to the smaller files both by the Nanoflash and the SxS card..  I would drop the soundtrack from SxS onto my time line and sync it up for him first with the noise processed Nano video files if I could figure out why it isn't following the video onto the time line?  Why does the 1080 60P codec from the Sony NEX 5N still camera bring the audio along automatically and the file fromn the Sony PMW 320 does not?  There must be a lot of EX1 and EX3 shooters here.  Please, what do I need to do with the buttons or targeting or settings for the 2 audio tracks on time line for those files to have the audio come along?  From the SxS files I imported, both the ones that say "CLPR" and right below that, "CUEUP.XML"  play the sound in the browser source window.

  • How to make a movie in LabView Real-Time

    I know that the IMAQ AVI routines do not work under LabVIEW RT (which sucks BTW), but I really need to make some sort of movie file from the images that I get from a PXI-1411 card under LabView RT.   I want to make a time lapse movie, so I would take a frame every 5 minutes or so, and then append it to an AVI or .MOV or other file.  Is there a third party tool that could do this or some other way to do this under LabView RT? I really don't care what the format of the file is just so that it can be displayed on a web browser.

    Hi Kirk -
    I believe the method discussed in this post is the most reasonable: http://forums.ni.com/ni/board/message?board.id=200&message.id=10160#M10160
    I don't know of any 3rd-party tools for creating movie files in LVRT.  The AVI functions can't be supported in LVRT because they're based on DirectShow functionalities, which are only available in Windows environments. 
    David Staab, CLA
    Staff Systems Engineer
    National Instruments

  • I am learning how to make a web page but every time I try to view my file it refuses to open saying the file is not protected from view by outsiders.

    I set up the file as index.html. When I try to view it on Firefox it won't open the file.

    Hi Kirk -
    I believe the method discussed in this post is the most reasonable: http://forums.ni.com/ni/board/message?board.id=200&message.id=10160#M10160
    I don't know of any 3rd-party tools for creating movie files in LVRT.  The AVI functions can't be supported in LVRT because they're based on DirectShow functionalities, which are only available in Windows environments. 
    David Staab, CLA
    Staff Systems Engineer
    National Instruments

  • How to make one bullet point at a time show up in Keynote?

    if anyone knows the answer let me know asap thanks so much

    Select the text. Go to the Build Inspector. Click "Build In". Select an effect. Under "Delivery", select "By Bullet".

  • How to make a custom infotype field the time constraint 1?????

    Hello everyone I have this challenging question for gurus to answer it.
    In custom created infotype for OM Ii have that field called ZZJOBID. When infotype was created I assigned the time constraint 1 for that infotype. That time constraint was base on OBJID not on ZZJOBID. Now the problem I am encountering is when I assign the 2nd ZZJOBID  with time span 01011800-12319999 it overwrite the 1st assign ZZJOBID.
    for the requirement reason I have to use PO10( not po03). If I change the time constraint to 3 which let me have the multiple records but I am losing the delimit and other functionality which comes with time constraint 1.

    Suresh,
             you are wright when you say that ' Time Constraint is for the Infotype/Subtype record and cannot be based off a field.' The OM infotype runs on bases of Object such as Organizational Unit, Job, etc... The point I was trying to draw is I am looking for a way that allow me to work via TC PO10 which run on Organizational Unit along with different ZZJOBID (with same begda and endda, if needed).

  • How to make materialized view fast refresh parallel

    We have Oracle 11.2.0.1 on Redhat 5.2. We use a dozen of fast refresh materialized views in our application.
    From time to time MV refresh takes longer time than the refresh interval.
    One of way to improve performance of MV refresh is to make the refresh parallel, e.g. http://www.dba-oracle.com/t_materialized_views_refreshing_performance.htm
    - Use parallel DML - Oracle author Michael Armstrong Smith notes "I've done parallel materialized view refreshing
    on tables recently and improved the load times considerably. Rather than having one load which took 2 hours,
    I run 4 parallel loads, one for each partition. The length of time for the whole process is now determined by
    how long the biggest partition takes to load. In my case, this is 40 minutes, with two 30 minute loads and one
    20 minute load.  Overall I am saving 1 hour 20 minutes. I can now add further partitions and do the same thing.
    My only limitation is the parallel loads because I don't have unlimited processing power.
    {code} My master tables are not partitioned, but think parallel will still better than non-parallel.
    Now the question, how to make refresh parallel. According to the paragraph cited above, Use parallel DML appears doing the job. Can someone  confirm that.
    We use {code}
    alter materialied view MV_OFFENSE parallel REFRESH FAST start with sysdate next sysdate+ 1/24;
    {code}to schedule refresh. Does the parallel clause here parallels query the MV or refresh the MV?
    Any other way to make MV refresh parallel?
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Doc http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/refresh.htm#i1006319 says:
    >
    In a data warehousing environment, assuming that the materialized view has a parallel clause, the following sequence of steps is recommended:
    1.
    Bulk load into the fact table
    2.
    Enable parallel DML
    3.
    An ALTER SESSION ENABLE PARALLEL DML statement
    4.
    Refresh the materialized view

  • How to make a service available at boot.

    Can someone tell me how to make a service available at boot time via smf ? The question is for a generic service ( network/telnet for example ) and for a site one.
    Is it enough to enable it via svcadm ?
    Thanks.

    yeah all you need to do is
    svcadm enable /network/telnet
    this will enable the service then and next time when you boot the system
    (or i.e. svcadm disable apache2 if you want to disable the httpd)
    have you tried man on svcadm?
    Sharif

  • How to make symbol changeable?

    hi
    im making a flash animation in which i made a symbol called #_mc which is in a symbol called #_anim_mc withhin the sceane.
    the #_mc contain "#". the #_anim_mc contain motion tween of the the "#" coming in from the left to the right. now within the main timeline i duplicated the #_anim_mc 100 times and i need to switch them with numbers but not all togethor. one by one. for ex: the 1st after 20 frames the 2nd after 28 frames etc.  now i dont know how to make changes in each one to time them when to switch to a number. the only think i can think about is to make 100 differnt symbol each one allready set to its own timing. im not so fermiliar with scripts.
    any idea anyone?
    thanks.

    It is possible to do the same using action script. At the same time you don't need to create 100 different symbols if the animation is same. Just create a single anim_mc symbol which has a #_mc symbol as its child. Use the copy motions as action script option and paste the code on the actions window of respective frames that you want to animate. After doing so, u can remove the tween from the main timeline.
    (For more information on copy motion on action script refer to the following link);
    http://blogs.adobe.com/rgalvan/2007/05/copy_motion_to_as3.html

Maybe you are looking for

  • Applications there but not there

    Small problem. Just bought a new iMac. Copied my iTunes library in totality from my work MacBook Pro onto the new machine. Plugged my iPhone in to sync. Everything works fine - it asked me to authorise new computer with my iTunes store account. Then

  • Want to remove some AutoComplete entries in Numbers

    I have the latest version of Numbers running on Yosemite 10.10.2. I would like certain autocomplete entries to vanish. Other posts say that you have to fix the cell with the entry, but it seems that as soon as you exit the cell, it is retained foreve

  • This program was created to automate the download of joblogs and spools for

    Hi All, please suggest me the ways through which i can create a  program  to automate the download of joblogs and spools for the ARCHIVE process. thanks Ankit

  • Specified workbook not found (Discoverer 4i with Ora Apps)

    I am using Discoverer 4i with Oracle 11i. When I try to open any workbook via any responsibility (of Oracle Apps) I get Error ‘Specified workbook not found: <workbook name>’ When I click OK on error, all my work books are listed. I have made sure use

  • Form attachments (paper clip vs. button)

    Hi, is it possibel to disable the paper clip functionality in Reader / Acrobat and have full control on attachments in a form via scripted buttons? For example hadnle paper clip events and block the functionality (add and remove of attachments) Thank