Top
Top
LibraryEASYProcess Reference ManualProcessesServicesFileSystemWorkshopAppendFile

AppendFile Overview

The AppendFile service allows you to append free-from text to any text-based file. Make sure that the user account has write permission and that the file exists. This service will not automatically create a non-existing file, so the WriteFile service must be used if the file does not exist.


AppendFile Use Examples
Workshop:FileSystemWorkshop
Service:AppendFile
Inputs
FileNameRequired. The full path of the file. You can also use a network path. For example, \\[Server Name]\[Directory]\[File Name]. Make sure that the user account has proper permissions to the shared directory.

DataRequired. The text to be appended to the file.

InsertNewLineThere are three valid values. Before - a new line is inserted before the Data. After - a new line is inserted after the Data. None or blank - no new line is inserted.

Outputs
AppendedReturns True/False depending on whether the service was able to successfully append the file.

AppendFile Use Examples

Basic AppendFile Use

This is an example that we first check if the file exists in the directory. If it does, we append the text to the original file. If it doesn’t, we create a new file.

For testing, TextAttach.txt already exists. The text in AppendFile will be written at the end of original text.

If in AppendFile, we set InsertNewLine to ‘Before’, new text will be added in a new line. This is useful if you want to use ReadFile and ReadAllLines later.

If the file doesn’t exists, AppendFile will throw the following error.


Powered by EASYProcess (© 2019 K-Rise Systems, Inc).