Java version of CFDIRECTORY: Updated
Tagged Under : CFDIRECTORY, ColdFusion
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 :-
- Instead of using list(), the function now uses listFiles() method which gives direct access to the underlying methods like getName(), getParent() etc .
- I converted the long Date variable to a CF Date object using java.util.Date .
- 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 :-