Java version of CFDIRECTORY: Updated

Tagged Under : ,

My original post on this subject got some improvements and suggestions from different people. So I decided to put together all the improvements and write a new post. The improvements were suggested by Dan Wilson and Qasim Rasheed. Thanks to both of them. The function can be found here Updated DirectoryListing Function.
Here is what has changed :-

  1. Instead of using list(), the function now uses listFiles() method which gives direct access to the underlying methods like getName(), getParent() etc .
  2. I converted the long Date variable to a CF Date object using java.util.Date .
  3. The code is lesser now and all the unnecessary CreateObject() calls are now removed.

Update : 21/02/2008

I have received some modified code from Ed Martin which he talks about in his comments below. Thanks Ed. Here is the code :-

Java version of CFDIRECTORY

Tagged Under : ,

I had some free time today so I thought of writing some code to mimick CFDIRECTORY functionality using Java objects. As always, the idea of being able to call Java from within CF has always got me excited. I have seen a lot of code out there that uses JAVA to list files in a directory, however, I havent seen any code that returns all the attributes that CFDIRECTORY does. So this is what I decided to do today. More »