Concatenate Files

Concatenates the contents of two or more files and outputs the result to a single destination file. If the destination file does not exist, it will be created. You can specify more than one file name with the use of wildcard characters (i.e. * or ?). If entering a list of file names, the files will be concatenated in the order they are entered. Generally used to quickly join a group of files (typically text based files such as log files) together into a single file.

Declaration

<AMCONCATENATEFILE FILEA="Text" FILEB="Text" CONCATENATEDFILE="Text" OVERWRITEFILE="Text" />

Example

<AMCONCATENATEFILE FILEA="C:\FolderA\FileName1.DOC" FILEB="C:\FolderB\FileName2.doc" CONCATENATEDFILE="C:\FolderC\NewConcatenatedFile" OVERWRITEFILE="YES" />

See Also: Touch File, Get File(s) information, Move File, Split File, Rename File, Write to File

General Tab

Property

Type

Required

Default

Markup

Description

File A

Text

Yes

(Empty)

a)FILEA="c:\FolderA\FileA.txt"

b)FILEA="c:\FolderA\*.txt"

The path and file name of the first file to concatenate. To specify more than one file, use wildcard characters (i.e. * or ?).

NOTE: Since multiple files are supported, you can specify all files you want to concatenate within this parameter using the appropriate wildcards. The File B parameter can then be left blank.

File B (Optional)

Text

No

(Empty)

a)FILEA="c:\FolderA\FileA.txt"

b)FILEA="c:\FolderA\*.txt"

The path and file name of the second file to concatenate. To specify more than one file, use wildcard characters (i.e. * or ?).

NOTE: Since multiple files are supported, you can specify all files you want to concatenate in the File A parameter using the appropriate wildcards and skip this parameter altogether.

Concatenated File

Text

Yes

(Empty)

CONCATENATEDFILE="C:\Temp\FileB.txt"

The path and file name of the output (concatenated) file. If this file does not exist, it will be created during runtime.

Overwrite if file exists

Yes/No

No

No

OVERWRITEFILE="YES"

If set to YES, output (concatenated) files that already exist will be overwritten. This parameter is set to NO by default.

Encoding for concatenated file

Text

(Options)

No

Default

ENCODING="UTF8"

The encoding method set for the output (concatenated) file.

The available options are:

  • Default - The default text file encoding of the host operating system.

  • Unicode - Encoding set to Unicode.

  • UTF8 - Encoding set to UTF8.

  • ASCII - Encoding set to ASCII.

NOTE: Most of the time, using the default encoding scheme for the locale of the host operating system is good enough. However, this parameter is useful if you are working with files that originate from another source.

Options Tab

Property

Type

Required

Default

Markup

Description

Include Subfolders

Yes/No

No

No

SUBFOLDERS="YES"

If set to YES, specifies that, if present, subfolders should be searched for files matching the mask specified in the File A and/or File B parameters. This parameter is set to NO by default.

Exclude Mask

Text

No

(Empty)

EXCLUDE="*.txt"

Causes this action to omit files matching the mask(s) specified. File names or wildcard masks may be used.

Regular Expression

Yes/No

No

No

RE="YES"

If set to YES, specifies that the data entered under the Exclude Mask field is a regular expression.

Attributes Tab

Property

Type

Required

Default

Markup

Description

Attributes

Text Options

No

(Empty)

ATTRFILTER="+R+A-H" (concatenate read-only & archive files but not hidden files)

This group of settings causes the action to filter which files are concatenated based on the attribute settings of the source file(s). In visual mode, a group of controls are provided to assist in the selection of this parameter. In markup mode, a single text item must be specified that contains the attributes of the files you want to compress.

Available Options:

  • R— Read-only: Specifying "+R" causes files with this attribute turned on to be included, "-R" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • A— Archive: Specifying "+A" causes files with this attribute turned on to be included, "-A" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • S— System: Specifying "+S" causes files with this attribute turned on to be included, "-S" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • H— Hidden: Specifying "+R" causes files with this attribute turned on to be included, "-H" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • C— Compression: Specifying "+C" causes files with this attribute turned on to be included, "-C" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

Description Tab

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Tab

The Error Causes tab allows you to select/omit specific errors that should cause a particular step to fail.

More on Error Causes properties

On Error Tab

The On Error tab allows you to determine what the task should do if a particular step encounters an error.

More about On Error properties

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (Example: %myVariable% or % Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking the percent sign % or pressing F2.

More on variables

More on expressions

More on the Expression Builder