Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving file to another folder

Status
Not open for further replies.

alexpr

Programmer
Aug 30, 2011
1
PR
Hi my script automatically generates and export a .txt and its working fine but the problem is that i will like to move exported file to another folder.. here is my code below


<cfsetting enablecfoutputonly="yes"> <!--- Required for CSV export to function properly --->

<cfcontent type="text/plain">
<cfheader name="Content-Disposition" value="attachment;filename=filename.txt">
<!--- Output Column Headers --->

<!--- Spill out data from a query --->


<CFOUTPUT query="#QueryName#" maxrows="15" startrow="#Row#"><CFLOOP From="1" To="#ListLen(ListFields)#" Index="FieldIndex"><CFIF IsDefined("ListFieldSums") AND ListFieldSums IS NOT "" AND ListGetAt(ListFieldSums, FieldIndex) IS NOT "x"><CFSET "sum#FieldIndex#" = evaluate("sum#FieldIndex#") + evaluate(ListGetAt(ListFields,FieldIndex))></CFIF><CFIF IsDefined("ListFieldFunctions")AND ListGetAt(ListFieldFunctions,FieldIndex) IS NOT "x"><CFSET FunctionCall ="#ListGetAt(ListFieldFunctions,FieldIndex)#(#chr(34)##evaluate(ListGetAt(ListFields,FieldIndex))##chr(34)#)">#evaluate(FunctionCall)#<CFELSE>#evaluate(ListGetAt(ListFields,FieldIndex))#</CFIF>|</CFLOOP>#chr(13)##chr(10)#</CFOUTPUT>



<cffile action="move"
source="attachment;filename=filename.txt"
destination="#expandpath('test/')#">


thanks in advanced
 
Technically the code does not generate a physical file. The code only outputs information and uses a cfheader to force the browser to treat it as an attachment. So there is nothing to move.

i will like to move exported file to another folder

Can you elaborate?

----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top