The File Copy Writer module provides FME with direct access to copying or moving files or folder contents on local or remote file systems to the destination dataset folder or another user-specified destination folder.
The format of these files will remain unchanged; however, the permissions settings will be determined by the destination machine operating system and file system location.
Source files or folders are provided on individual features sent to the File Copy writer. The features themselves are ignored in terms of attributes and geometry, and are only parsed for specific format attributes that are relevant to the writer. Thus, the writer is modeled as a fixed schema with only one possible destination feature type allowed and no user attributes.
This writer supports two file operation modes: COPY and MOVE. These reflect the corresponding file system calls to copy or move data files, respectively. Both operations support:
- absolute and relative paths
- file or folder (contents only) input
- optional copying of subfolders
- overwriting of existing files in the destination folder
Relative paths are with respect to the workspace folder.
The source data location is specified on each input individual feature to the writer using a format attribute called filecopy_source_dataset. The destination data location is by default provided by the writer dataset, which must be a folder. Additionally, the format attribute filecopy_dest_dataset can be used to specify a destination folder formatted as either relative, absolute, or UNC and must be specified using forward slashes (c:/temp/) or escaped backslashes (c:\\temp\\).
If the destination folder from the filecopy_dest_dataset format attribute is an absolute or UNC path, it will replace the destination dataset entirely; however, if it is a relative path, it will be appended to the destination folder. Other than this case, relative paths are with respect to the workspace folder. All other components of any input features are ignored.
When files are copied or moved, by default the original file names are preserved. However if the format attribute filecopy_source_dataset is a file, then the format attribute filecopy_dest_filename can be used to specify a new filename.
File naming conflicts can be resolved through the Overwrite Existing File parameter, which directs the writer to overwrite the files in the output folder if name collisions occur. Also, if the source location provided is a folder, subfolders and their contents may be optionally copied to the destination location as well.
Input sources include files and folder names formatted as either relative, absolute, or UNC names, and must be specified using forward slashes (c:/temp/) or escaped backslashes (c:\\temp\\). Relative paths are with respect to the workspace folder.
Pattern support is supported on the input dataset in the form of simplified globing which is much like regular expressions. Only two characters are supported: the asterisk (*) and question mark (?).
For example, an input source of
could match all files with the extension .txt in the c:/temp/ folder, provided that it exists and is accessible according to file system permissions.
Note: There is currently no support for progress indication during long copy operations, and canceling a copy operation may result in corrupt output data in the destination folder.
The File Copy writer ignores all the contents of the input features except for specific format attributes. A copy operation can be performed per input feature.
Input features without sufficient information to perform a copy or move operation are ignored.