Quick Tip: cffile action=”append” in cfscript
So this is old news - like ColdFuison 8 old news - but I've only started to use cfscript heavily with ColdFusion 9 so I just ran into this today. If you need to append to a file in cfscript you first need to use FileOpen() to open a file object in the append mode.
Then you can append to the file using FileWrite():
Note that unlike the default behavior of <cffile action="append"> FileWrite() does not append a newline character to text written to file.
Appending to a file isn't documented on the FileWrite() documentation for either ColdFusion 8 or ColdFuison 9, and the documentation does not list FileOpen() in the See Also section, so this took me a lot longer to figure out than it should have. Anyway, I hope this helps others making the transition from tag based to script based CFML.



