File System - Concatenate Files

Declaration

<AMFILESYSTEM ACTIVITY="concatenate_files" SUBFOLDERS="yes/no" 
EXCLUDE="text" RE="yes/no" ISNEWERTHAN="DateSerial%" 
FILEA="text" FILEB="text" CONCATENATEDFILE="text" 
ENCODING="text (options)" OVERWRITEFILE="yes/no" />

Description: Concatenates the contents of two or more files and outputs the result onto a destination file. Specify more than one filename with the use of wildcard characters (e.g., * or ?). To specify multiple files or wildcard masks, separate them with a pipe symbol (e.g., c:\*.

Practical Usage

Generally used to quickly join a group of files (typically text-based files) together into a single file.

General Parameters

Property

Type

Required

Default

Markup

Description

File A

Text

Yes

(Empty)

  1. FILEA="c:\FolderA\FileA.txt"

  2. FILEA="c:\FolderA\*.txt"

  3. FILEA="c:\File.txt|c:\File.bak

The path and filename of the first file to concatenate. To specify multiple files with identical extensions, use basic wildcard characters (e.g., *. txt). In this case, files will be concatenated in alphabetical order. To specify multiple files or wildcard masks, separate them with a pipe symbol (e.g., c:\*.

NOTE: Since multiple files are supported, you can indicate all files you wish to concatenate within this parameter using the appropriate wildcards and skip the File B parameter altogether.

File B (optional)

Text

No

(Empty)

  1. FILEB="c:\FolderB\FileB.txt"

  2. FILEB="c:\FolderB\*.txt"

  3. FILEB="c:\File.txt|c:\File.bak

The path and filename of the second file to concatenate. To specify multiple files with identical extensions, use basic wildcard characters (e.g., *. txt). In this case, files will be concatenated in alphabetical order. To specify multiple files or wildcard masks, separate them with a pipe symbol (e.g., c:\*.

NOTE: Since multiple files are supported, you can indicate all files you wish 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 filename of the output (concatenated) file. If this file does not exist, it will be created at runtime.

Overwrite if file exists

Yes/No

No

No

OVERWRITEFILE="YES"

If set to YES, indicates that, if files with matching names already exists in the destination, they will be overwritten. If set to NO, files with matching names will not be overwritten, however, an error will occur as a result. The default value is NO.

Encoding for concatenated file

Text

(Options)

No

Default

  1. ENCODING="ANSI"

  2. ENCODING="UNICODE"

  3. ENCODING="UTF8"

  4. ENCODING="ASCI"

The encoding method set for the output (concatenated) file. The available options are:

  • ANSI - Encoding set to ANSI.

  • Unicode (default) - Encoding set to Unicode.

  • Unicode big endian - Encoding set to Unicode big endian.

  • UTF8 - Encoding set to UTF8.

  • ASCII - Encoding set to ASCII.

NOTE: Most of the time, using the default encoding scheme (Unicode) 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.

File Options Parameters

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)

  1. EXCLUDE="*.txt"

  2. EXCLUDE="*.txt|*.bak

  3. EXCLUDE="c:\foldename"

Causes this activity to omit files matching the mask(s) specified. Filenames or wildcard masks may be used. Multiple entries may be specified by separating them with a pipe symbol (|), for example: *.txt|*.bak

Regular expression

Yes/No

No

No

RE="yes"

If set to YES, indicates that any value entered in the Exclude mask parameter will be interpreted as a regular expression. If set to NO (default) the value will be interpreted as normal readable text.

Only if newer than

Date

No

(Empty)

ISNEWERTHAN=

"%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

If enabled, causes this activity to only act on files that are newer than the date/time specified. If this parameter is left blank or disabled (default), file dates are ignored. Click the Custom button to select from a list of pre-defined date parameters. Enable the Expression option to allow entry of a date/time expression.

Only if older than

Date

No

(Empty)

ISOLDERTHAN=

"%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

If enabled, causes this action to only act on files that are older than the date/time specified. If this parameter is left blank or disabled (default), file dates are ignored. Click the Custom button to select from a list of pre-defined date parameters. Enable the Expression option to allow entry of a date/time expression.

File Filter Parameters

Property

Type

Required

Default

Markup

Description

Attributes

Text Options

No

(Empty)

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

This group of settings causes the action to filter which files are compressed 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 wish 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 - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

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