I write this script when my team have to debug our program at our client but don’t want got headache where the file is in the directory when we bring back to our office.
just a simple script, but it help me
here is the code
<cfoutput>
<cfparam name="defaultDirectory" default="semenpadang">
<form action="index.cfm" method="post">
<table>
<tr>
<td>Default Directory</td>
<td>:</td>
<td><input type="Text" name="defaultDirectory" value="#defaultDirectory#"></td>
</tr>
<tr>
<td>Full Path File Name</td>
<td>:</td>
<td><input type="Text" name="fullPathFileName" size="100"></td>
</tr>
<tr>
<td colspan="3"><input type="Submit" value=" Copy " name="btnSubmit"></td>
</tr>
</table>
</form>
<cfset Today = DateFormat(Now(), "yyyy-mm-dd")>
<cfset Expand_Path = ExpandPath("./")>
<cfset Expand_Path = Expand_Path & Today & "\">
<cfif IsDefined("FORM.btnSubmit")>
<cfset defaultDirectoryLocation = ListFindNoCase(FORM.fullPathFileName, FORM.defaultDirectory, "\")>
<cfset copyFullPathFileName = FORM.fullPathFileName>
<cfloop index="intI" from="1" to="#defaultDirectoryLocation - 1#">
<cfset copyFullPathFileName = ListDeleteAt(copyFullPathFileName, 1, "\")>
</cfloop>
<cfset directoryToCreate = ListDeleteAt(copyFullPathFileName, ListLen(copyFullPathFileName, "\"), "\")>
<cfset createdDirectory = "">
<cfloop list="#directoryToCreate#" index="directoryList" delimiters="\">
<cfset createdDirectory = ListAppend(createdDirectory, directoryList, "\")>
<cfif not DirectoryExists("#Expand_Path#\#createdDirectory#")>
<cfdirectory action="CREATE" newdirectory="#directoryList#" directory="#Expand_Path#\#createdDirectory#">
</cfif>
</cfloop>
<cffile action="COPY" source="#FORM.fullPathFileName#" destination="#Expand_Path##createdDirectory#\#ListLast(copyFullPathFileName,'\')#">
</cfif>
<cfdirectory action="LIST" name="listOfDirectory" directory="#Expand_Path#" recurse="Yes">
<cfquery name="listOfDirectory" dbtype="query">
SELECT * FROM listOfDirectory WHERE TYPE = 'File'
ORDER BY DIRECTORY, NAME
</cfquery>
<cfdump var="#listOfDirectory#">
</cfoutput>
or you can find it at http://docs.google.com/Doc?id=dhr2c3jq_9ffpf99