|
File System - Concatenate files |
Declaration
<AMFILESYSTEM ACTIVITY="concatenate_files" FILEA="text" FILEB="text" CONCATENATEDFILE="text" ENCODING="text (options)" OVERWRITEFILE="YES/NO" SUBFOLDERS="YES/NO" EXCLUDE="text" RE="YES/NO" ISNEWERTHAN="%DateSerial+TimeSerial%" ISOLDERTHAN="%DateSerial+TimeSerial%" ATTRFILTER="+r+a+s+h-c-e" />
Description
Concatenates the contents of two or more files and outputs the result onto a destination file. Specify more than one file name with the use of wildcard characters (for example, * or ?). To specify multiple files or wildcard masks, separate them with a pipe symbol (for example, c:\*).
Practical Usage
Generally used to quickly join a group of files (typically text-based files) together into a single file.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
File A | Text | Yes | (Empty) |
|
The
path and file name of the first file to concatenate. This can be a fully
qualified path and file name (preferred) or a single file (requires
use of the File System - Change
folder activity). Wildcard characters (for example, * or ?) may be
used to specify all files matching a certain mask. Multiple files
and/or file masks can be specified by separating each entry with
a pipe character (|) (for example, c:\temp\*.txt|c:\backup\*.bak).
See File
Masks & Wildcards for more details. 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) |
|
The
path and file name of the second file to concatenate. To specify
multiple files with identical extensions, use basic wildcard characters
(for example, *. txt). In this case, files will be concatenated in alphabetical
order. To specify multiple files or wildcard masks, separate them
with a pipe symbol (for example, 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 file name 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 selected, indicates that, if files with matching names already exists in the destination, they will be overwritten. If disabled, 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 |
|
The
encoding method set for the output (concatenated) file. The available
options are:
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
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Include subfolders | Yes/No | No | No | SUBFOLDERS="YES" | If selected, 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 disabled by default. |
Exclude mask | Text | No | (Empty) |
|
Causes this activity to omit files matching the masks 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 selected, indicates that any value entered in the Exclude mask parameter will be interpreted as a regular expression. If disabled (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
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Attributes | Text (options) | No | Doesn't matter | ATTRFILTER="+R+A-H" (compress read-only & archive files but not hidden files) | Instructs
the activity to filter which files to act on, based on whether
the file's original attribute settings match the attribute settings
specified in this parameter. In Task Builder's visual mode, drop-down boxes are provided within the activity's settings
to assist in the selection of attribute settings. In Task Builder's AML mode,
a text item must be entered that contains the original
attribute mask of the files you wish to affect. For example, if Read-only
attribute is set to Off
(in visual mode) or -R (in AML mode) , only source files with the Read-only attribute
turned off are affected. Source files with Read-only attribute turned
on will be ignored. The available options
are:
|
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 files. 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:
|
Example
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
This sample task concatenates two separate files from separate folders into a single file in a new folder.
<AMFILESYSTEM ACTIVITY="concatenate_files" FILEA="C:\FolderA\FileName1.DOC" FILEB="C:\FolderB\FileName2.doc" CONCATENATEDFILE="C:\Folder\NewConcatenatedFile " OVERWRITEFILE="YES" />