Ok so what im trying to do here is set putme to be coding so that when the test.txt is read it replaces <!--ReplaceMe --> with the contents of putme. How do i get putme to just store it at text instead of coding?

<!-- Start putme -->
<cfset putme = "<cfelseif #GetFiles.Name# contains #GetFiles.Name#>
  <cfset #Property# = #GetFiles.Property#>
    <cffile action="rename"
        source="D:/home/wwwroot/technet/Uploads/#GetFiles.Name#"
        destination="D:/home/wwwroot/technet/property/#property#/temp/#DateFormat(DateAdd('d', -1, MyDateTime),'mm dd, yyyy')# #Name#">
 <!--ReplaceMe -->
">
<!-- End putme -->

    <cffile action="read"
            file="D:/home/wwwroot/technet/test.txt"
            variable=contents>
    <cfset #contents# = #Replace(contents, "<!--ReplaceMe -->", "#putme#", "all")#>
    <cfset #indexfile# = #dirname# & "\test.txt">
    <cffile action="write"
            file=#indexfile#
            output=#contents#>

The only way I know of is to use CFSAVECONTENT. But IIRC you have to escape CF tags. Otherwise, they're evaluated immediately instead of being treated as a plain string.

<cfsavecontent variable="putme">
.. whatever code you want here. 
...tags will be evaluated unless they're escaped 
</cfsavecontent>
<!--- see what the contents look like ... --->
<cfdump var="#putme#">

<cfset #contents# = #Replace(contents, "<!--ReplaceMe -->", "#putme#", "all")#>

Btw: You don't need all those excess # signs!

<cfset contents = Replace(contents, "<!--ReplaceMe -->", putme, "all")>

ok this one has me its still trying to evual the cfif

Could you please code this for me so it might work Iam am having a hard time with this one..

<cfsavecontent variable="putme">

<cfelseif #GetFiles.Name# contains 'AB'>
  <cfset #Property# = 'ABC'>
  	<cffile action="rename"
  	    source="D:/home/catalinasecurity.com/wwwroot/technet/Uploads/#GetFiles.Name#"
		destination="D:/home/catalinasecurity.com/wwwroot/technet/property/#property#/temp/#DateFormat(DateAdd('d', -1, MyDateTime),'mm dd, yyyy')# #Name#">

</cfsavecontent>

Like I said, I think have to html escape the tags to preven them from being evaluated
ie < becomes &lt; and > becomes &gt;

But I'm not sure even that would work. What are you trying to do exactly?

Hi axgold472,

Did you get this one figured out?
Here is an example of what you are trying to do:

<cfset putme = "
	<cfelseif ##GetFiles.Name## contains 'AB'>
	  <cfset ##Property## = 'ABC'>
		<cffile action='rename'
		    source='D:/home/catalinasecurity.com/wwwroot/technet/Uploads/##GetFiles.Name##'
			destination='D:/home/catalinasecurity.com/wwwroot/technet/property/##property##/temp/01 12, 2011 ##Name##'>
" >

<cffile action="write" file="#ExpandPath('/abc.cfm')#" output="#putme#" >

Ouch. Just looking at all those excess pound signs hurt my eyes ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.