Component family |
File/Management |
|
Function |
This component copies a source file or folder into a target |
|
Purpose |
This component helps to streamline processes by automating |
|
Basic settings |
File Name |
Specify the path to the file to be copied. This field does not appear when the Copy a |
|
Copy a directory |
Select this check box to copy a directory including all |
|
Source directory |
Specify the source directory to copy. This field appears only when the Copy a |
|
Destination directory |
Specify the directory to copy the source file or directory |
|
Rename |
Select this check box if you want to rename the file copied to the This field does not appear when the Copy a |
|
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 This field does not appear when the Copy a |
|
Replace existing file |
Select this check box to overwrite any existing file with the This field does not appear when the Copy a |
|
Create the directory if it doesn’t exist |
Select this check box to create the specified destination This field does not appear when the Copy a |
Advanced settings |
tStatCatcher Statistics |
Select this check box to gather the Job processing metadata at a |
Usage |
This component can be used as a standalone component. |
|
Global Variables |
DESTINATION_FILENAME: the destination file name. This is DESTINATION_FILEPATH: the destination file path. This is SOURCE_DIRECTORY: the source directory. This is an After DESTINATION_DIRECTORY: the destination directory. This is ERROR_MESSAGE: the error message generated by the A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see Talend Studio |
|
Connections |
Outgoing links (from this component to another): Row: Main.
Trigger: On Subjob Ok; On Subjob Incoming links (from one component to this one): Row: Main; Reject; Iterate.
Trigger: Run if; On Subjob Ok; On For further information regarding connections, see |
|
Log4j |
The activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User For more information on the log4j logging levels, see the Apache documentation at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html. |
|
Limitation |
n/a |
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.
-
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. -
Connect tFileList to tFileCopy using a Row >
Iterate link. -
Double-click tFileList to open its Basic settings view.
-
In the Directory field, browse to or type in
the directory to iterated upon. -
Double-click tFileCopy to open its Basic settings view.
-
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”)). -
In the Destination directory field, browse to
or type in the directory to copy each file to. -
Select the Remove source file check box to
get rid of the files that have been copied. -
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.