RE: Recursive Directory - ColdFusion Component
I was a bit bored at home last night and since I'm trying to learn java I wrote one as a java cfx, it's pretty damn quick, you may find it useful. Call it with.. cfx_recursiveDir dir=c:\aDir queryname=myNewCFQuery It creates a query object in the calling cf template. ---code import com.allaire.cfx.*; import java.io.*; public class recursiveDir implements CustomTag{ public void processRequest( Request request, Response response ) throws Exception{ if (!request.attributeExists(dir) || !request.attributeExists(queryname)) { throw new Exception(Missing attribute 'dir'); } String dir = request.getAttribute(dir); String queryname = request.getAttribute(queryname); String[] columns = { Type , filename} ; Query query = response.addQuery( queryname, columns ) ; recurseInDirFrom(dir,query); } public void recurseInDirFrom(String dirItem, Query query) { File file; String list[]; String type; file = new File(dirItem); if (file.isDirectory()) { list = file.list(); for (int i = 0; i list.length; i++) recurseInDirFrom(dirItem + File.separatorChar + list[i], query); type = Directory; } else { type = File; } int iType = 1, iFilename = 2; int iRow = query.addRow() ; query.setData( iRow, iType, type ) ; query.setData( iRow, iFilename, dirItem ) ; } } ---/code Hope someone finds it useful, though it didn't take long to write, (I found the resursion bit in an online example) -Original Message- From: Calvin Ward [mailto:[EMAIL PROTECTED] Sent: 18 June 2003 12:23 To: CF-Talk Subject: Recursive Directory - ColdFusion Component Has anyone made one of these? Calvin ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Recursive Directory - ColdFusion Component
Has anyone made one of these? Calvin ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Recursive Directory - ColdFusion Component
What exactly is one of these - Original Message - From: Calvin Ward [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 7:23 AM Subject: Recursive Directory - ColdFusion Component Has anyone made one of these? Calvin ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Host with the leader in ColdFusion hosting. Voted #1 ColdFusion host by CF Developers. Offering shared and dedicated hosting options. www.cfxhosting.com/default.cfm?redirect=10481 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Recursive Directory - ColdFusion Component
Something like this... In calling page.. cf_dir basedir = c:\java cfdump var=#request.filelist# dir.cfm -- cfparam name=request.filelist default=#QueryNew('Filename,FileDate,Size')# cfdirectory action=LIST directory=#attributes.basedir# name=list cfloop query=list cfif type is File cfscript QueryAddRow(request.filelist); QuerySetCell(request.filelist,FileName,#attributes.basedir##name#); QuerySetCell(request.filelist,FileDate,#DateLastModified#); QuerySetCell(request.filelist,Size,#Size#); /cfscript cfelse cfif NOT (name is . or name is ..) cf_dir basedir = #attributes.basedir##name#\ /cfif /cfif /cfloop -Original Message- From: Calvin Ward [mailto:[EMAIL PROTECTED] Sent: 18 June 2003 12:23 To: CF-Talk Subject: Recursive Directory - ColdFusion Component Has anyone made one of these? Calvin ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Recursive Directory - ColdFusion Component
twas in the subject, sorry :) Recursive Directory - ColdFusion Component - Original Message - From: Michael T. Tangorre [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 7:26 AM Subject: Re: Recursive Directory - ColdFusion Component What exactly is one of these - Original Message - From: Calvin Ward [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 7:23 AM Subject: Recursive Directory - ColdFusion Component Has anyone made one of these? Calvin ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Recursive Directory - ColdFusion Component
Check out directoryList() at cflib.org. === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Calvin Ward [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 6:00 AM To: CF-Talk Subject: Re: Recursive Directory - ColdFusion Component twas in the subject, sorry :) Recursive Directory - ColdFusion Component - Original Message - From: Michael T. Tangorre [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 7:26 AM Subject: Re: Recursive Directory - ColdFusion Component What exactly is one of these - Original Message - From: Calvin Ward [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 7:23 AM Subject: Recursive Directory - ColdFusion Component Has anyone made one of these? Calvin ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Recursive Directory - ColdFusion Component
Just finished one yesterday. Funny, I pinged the list and didn't get a response. Anyway, if you're intersted in the code mail me off list. ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Recursive Directory - ColdFusion Component
I made a CustomTag a long tome ago, but it still serves me well (although were I to do it over now I'd probably do it a bit differently). The code is open - feel free to convert it to a Component if you like: http://www.depressedpress.com/DepressedPress/Content/ColdFusion/CustomTa gs/DP_FileFind/Index.cfm Jim Davis President, http://www.depressedpress.com Webmaster, http://www.firstnight.org Webmaster, http://www.cfAdvocacy.org Senior Consultant, http://www.metlife.com -Original Message- From: Calvin Ward [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 7:23 AM To: CF-Talk Subject: Recursive Directory - ColdFusion Component Has anyone made one of these? Calvin ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Host with the leader in ColdFusion hosting. Voted #1 ColdFusion host by CF Developers. Offering shared and dedicated hosting options. www.cfxhosting.com/default.cfm?redirect=10481 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4