PutAppend

expr>>>filename

appends expr to a file.

PutAppend[expr1,expr2,,"filename"]

appends a sequence of expressions expri to a file.

Details

  • PutAppend works the same as Put, except that it adds output to the end of the file, rather than replacing the complete contents of the file.
  • PutAppend works with cloud objects.
  • PutAppend[,File["file"]] is also supported.

Examples

open allclose all

Basic Examples  (1)

Append expression values at the end of a temporary file:

In[1]:=
Click for copyable input

Create a directory for temporary files and change to that directory:

In[2]:=
Click for copyable input

Put the value of x in a file:

In[3]:=
Click for copyable input

Update x and append the new value to the file:

In[4]:=
Click for copyable input

The file now contains the two values:

In[5]:=
Click for copyable input

Append successive iterates to the file in a loop:

In[6]:=
Click for copyable input
In[7]:=
Click for copyable input

Reset to the original directory:

In[8]:=
Click for copyable input

Scope  (1)

See Also

Write  Put  Save

Tutorials

Introduced in 1988
(1.0)
| Updated in 2016
(11.0)