You can save a line of code by running the tag to create the images and then the CSS directories. The savings is because a CFDIRECTORY tag will create any parent directories it needs till the entire directory structure is created.
<cfdirectory action="create" directory="#BaseDir#"> <cfdirectory action="create" directory="#ImageDir#"> The first CFDIRECTORY tag will create the #form.clientDir# and the images directory and the second will create the css directory in #form.clientDir#. The newdirectory attribute is not needed as it only applies to CFDIRECTORY when your doing a rename action. >Hello folks, > >In need of some feedback,direction, examples etc, for a little routine I'm >playing with to learn a little more about using cf and more specifically, >cfdirectory. Basically passing a form variable into this to create my base >directory using the name passed from the form.....simple enough. I'm >wondering if there's any way to roll up all 3 directory actions into a >single tag or loop of some kind?? While this works fine, I'm just looking to >condense if possible....lazy in my old age I guess ;-) > ><cfset BaseDir = "D:\wwwsites\mysite\#form.clientDir#"> ><cfset ImageDir = "D:\wwwsites\mysite\#form.clientDir#\images"> ><cfset CSSDir ="D:\wwwsites\mysite\#form.clientDir#\css"> > ><cfdirectory action="create" newdirectory="testClient" >directory="#BaseDir#"> ><cfdirectory action="create" newdirectory="images" directory="#ImageDir#"> ><cfdirectory action="create" newdirectory="css" directory="#CSSDir#"> > > <cfdirectory action="list" directory="#BaseDir#" name="myDirList"> > <cffile action="write" file="#BaseDir#\index.cfm" output="Directories >created successfully."> > > <cffile action="read" file="#BaseDir#\index.cfm" variable="myVariable"> > <cfoutput> > #HTMLCodeFormat(myVariable)# > </cfoutput> > >TIA .... Old Fart ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2234 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
