• Post Reply Bookmark Topic Watch Topic
  • New Topic

File[] theFiles = aFile.listFiles(aFilenameFilter)  RSS feed

 
Paul Wetzel
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a file (that is really a directory) and then calling the listFiles method on the file object passing in an object that implements FilenameFilter. In the accept method FilenameFilter (method that needs to be implemented to implement FilenameFilter) will return true if filename ends on "log". On NT box the listFiles method will return all files that end in "log" in the directory and all sub directories. on unix box returns only files on main directory that ends with "log" but not any files in sub directory.

Any clues?
[This message has been edited by Paul Wetzel (edited November 02, 2000).]
I modified the source so the < symbol would show
[This message has been edited by Carl Trusiak (edited November 02, 2000).]
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What interests me is your implementation of accept. The method definition I see in the docs for 1.1, 1.2 and 1.3 is accept(File file) and you have it implemented as accept(File dir, String filename). Try changing the signiture of your accept and test it again.
Hope this helps
 
Paul Wetzel
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There exists 2 interfaces java.io FileFilter and FilenameFilter in that have a method accept() with different parameters (File aFile) and (File aDir, String fileName) respectively. The former Tests whether or not the specified abstract pathname should be included in a pathname list. The latter Tests if a specified file should be included in a file list. I think I will try the accept(File aFile) and see what happens. I will let you know.
thanks
paul
 
Paul Wetzel
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that didn't change anything...so now i am using recursion to get thje job done.
thanks
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks to me like youv'e run into a bug, you might consider submitting it to Sun's Bug database.
Good Luck
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!