Reputation: 1068
is there any way to create Directory inside the folders of our root Directory ?
for example
/var/www/test
is my current root directory and /var/www/test/newDir
the newDir is the Directory wherein I want to create directory and files.
i have tried this but got errors
<cffunction name="logError">
<cfargument name="path" required="true" />
<cfset var new_logDir = arguments.path />
<cfset var q = new_logDir/#DateFormat(Trim(Now()),"dd-mm-yyyy")# />
<cfdirectory action="create" directory="#q#" mode="775" />
</cffunction>
<cfset logDir = ExpandPath("./logger/") />
<cfset logError(logDir) />
I am trying to create new directory with today's date as the name of folder inside the logger directory which is the sub directory of my root directory test
.
Thanks.
Upvotes: 0
Views: 486
Reputation: 181
From your above example you may be having issues because of this line
<cfset var q = new_logDir/#DateFormat(Trim(Now()),"dd-mm-yyyy")# />
should be
<cfset var q = new_logDir & DateFormat(Trim(Now()),"dd-mm-yyyy") & "/" />
Upvotes: 2