• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

how sort a array of files and directories.. ?

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.util.*;
.
.
.
.
File[] filesInDir = directory.listFiles();
Arrays.sort(filesInDir);


but not work... for me, i need all directories, first... and then the files or viceverza... no problem, here the results (not like me):


Dir Name:C:\Documents and Settings\Miguel Enriquez\Favorites\assembler
Nombre Favorito: Art of Assembly Language Programming and HLA by Randall Hyde

Dir Name:C:\Documents and Settings\Miguel Enriquez\Favorites\assembler
Nombre Favorito: Art of Assembly Language Programming and HLA by Randall Hyde2

Dir Name:C:\Documents and Settings\Miguel Enriquez\Favorites
Nombre Favorito: Batanga - Latin Music Internet Radio

Dir Name:C:\Documents and Settings\Miguel Enriquez\Favorites\Becas
Nombre Favorito: CONACYT- Convocatoria de Demanda Libre 2004 - DAFCyT

see Batanga.... because Batanga are first than Becas.... but i want list
sorted, first the directries, and then my files....

any advice?
 
Sheriff
Posts: 28362
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answered in duplicate post.
 
Come have lunch with me Arthur. Adventure will follow. This tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic