fileAppend

Appends the data contents to the file.

fileAppend(file, data [, charset] [, addNewLine]) → returns void

Argument Reference

file string
Required

File path

data string
Required

Data to append to the file

charset string

The character encoding in which the file contents is encoded.

addNewLine boolean
Default: true

CF2016u11+ Indicates whether a new line is added to the end of the appended data

Compatibility

ColdFusion:

Prior to CF2016u11 and CF2018u4, charset param was required.

Examples
Sample code invoking the fileAppend function

Appends a mock entry to a file.

// Create mock log entry
logEntry = dateTimeFormat(now(), "yyyy/mm/dd HH:nn") & " this is a mock log entry!";

// Append line to file
fileAppend("/path/to/file.log", logEntry);

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub