July 30, 2023

tFileCopy – Docs for ESB 7.x

tFileCopy

Copies a source file or folder into a target directory.

tFileCopy Standard properties

These properties are used to configure tFileCopy running in the Standard Job framework.

The Standard
tFileCopy component belongs to the File family.

The component in this framework is available in all Talend
products
.

Basic settings

File Name

Specify the path to the file to be copied.

This field does not appear when the Copy a
directory
check box is selected.

Warning: Use absolute path (instead of relative path) for
this field to avoid possible errors.

Copy a directory

Select this check box to copy a directory including all
subdirectories and files in it.

Source directory

Specify the source directory to copy.

This field appears only when the Copy a
directory
check box is selected.

Warning: Use absolute path (instead of relative path) for
this field to avoid possible errors.

Destination directory

Specify the directory to copy the source file or directory
to.

Warning: Use absolute path (instead of relative path) for
this field to avoid possible errors.

Rename

Select this check box if you want to rename the file copied to the
destination.

This field does not appear when the Copy a
directory
check box is selected.

Destination filename

Specify a new name for the file to be copied.

This field appears only when the Rename check box is selected.

Remove source file

Select this check box to remove the source file after it is copied
to the destination directory.

This field does not appear when the Copy a
directory
check box is selected.

Replace existing file

Select this check box to overwrite any existing file with the
newly copied file.

This field does not appear when the Copy a
directory
check box is selected.

Create the directory if it doesn’t exist

Select this check box to create the specified destination
directory if it does not exist.

This field does not appear when the Copy a
directory
check box is selected.

Advanced settings

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at a
Job level as well as at each component level.

Global Variables

Global Variables

DESTINATION_FILENAME: the destination file name. This is
an After variable and it returns a string.

DESTINATION_FILEPATH: the destination file path. This is
an After variable and it returns a string.

SOURCE_DIRECTORY: the source directory. This is an After
variable and it returns a string.

DESTINATION_DIRECTORY: the destination directory. This is
an After variable and it returns a string.

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

This component can be used as a standalone component.

Connections

Outgoing links (from this component to another):

Row: Main.

Trigger: On Subjob Ok; On Subjob
Error; Run if; On Component Ok; On Component Error.

Incoming links (from one component to this one):

Row: Main; Reject; Iterate.

Trigger: Run if; On Subjob Ok; On
Subjob Error; On component Ok; On Component Error; Synchronize;
Parallelize.

For further information regarding connections, see

Talend Studio

User Guide.

Restoring files from bin

This scenario describes a Job that iterates on a list of files in a directory, copies
each file to a defined target directory, and then removes the copied files from the
source directory.

tFileCopy_1.png

Procedure

  1. Create a new Job and add a tFileList
    component and a tFileCopy component by typing
    their names in the design workspace or dropping them from the Palette.
  2. Connect tFileList to tFileCopy using a Row >
    Iterate link.
  3. Double-click tFileList to open its Basic settings view.

    tFileCopy_2.png

  4. In the Directory field, browse to or type in
    the directory to iterated upon.
  5. Double-click tFileCopy to open its Basic settings view.

    tFileCopy_3.png

  6. In the File Name field, press Ctrl+Space to access the global variable list and
    select the tFileList_1.CURRENT_FILEPATH
    variable from the list to fill the field with
    ((String)globalMap.get(“tFileList_1_CURRENT_FILEPATH”)).
  7. In the Destination directory field, browse to
    or type in the directory to copy each file to.
  8. Select the Remove source file check box to
    get rid of the files that have been copied.
  9. Press Ctrl+S to save your Job and press
    F6 to execute it.

    All the files in the defined source directory are copied to the destination
    directory and are removed from the source directory.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x