Handling the File Object
The Filesystem adapter comes with operations to be used on the file itself.
Retrieving File Information
Using the status operation of the Filesystem adapter, you can get some general information on the file.
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file/directory you want to read, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
size | Integer | out | Size of the file in Bytes. size is meaningless for directories, as it is not the combined size of all contained files and subfolders, but rather some constant defined by the operating system (e.g. 0 or 4096). |
type | String | out | Type of accessed element (File or Directory). |
accessTime | DateTime | out | Timestamp when the file/directory was accessed for the last time. |
creationTime | DateTime | out | Timestamp when the file/directory was created. |
modificationTime | DateTime | out | Timestamp when the file/directory was modified for the last time. |
You can use the size of a file to determine its end position for usage with the write operation.
Renaming a File
Using the rename operation of the Filesystem adapter, you can rename a file.
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to rename, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
newName | String | in | New name you want to rename the file to. We recommend to provide a fully qualified file name (including the path). |
Related Error Codes
Find a list of all File System Adapter error codes on System Errors of the File System Adapter.
Error Code | Description |
---|---|
| Failed renaming <file name>. |
Moving a File
Using the rename operation of the Filesystem adapter, you can move a file to another location simply by providing a new path with parameter newName.
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to rename, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
newName | String | in | New name you want to rename the file to. We recommend to provide a fully qualified file name (including the path). |
This only works inside the same filesystem. Trying to move files to mounted filesystems will result in a "cross-device-link" error.
Related Error Codes
Find a list of all File System Adapter error codes on System Errors of the File System Adapter.
Error Code | Description |
---|---|
| Failed renaming <file name>. |
Making a Copy of a File
Using the copy operation of the Filesystem adapter, you can copy a file.
Name | Type | Direction | Description |
---|---|---|---|
source | String | in | Fully qualified file name of the file you want to copy, including the path. |
target | String | in | Fully qualified file name of the target file, including the path. |
When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\".
To avoid this, use forward slashes with Windows as well.
copy supports copying huge files because it does not load the complete file into memory.
Removing a File
Using the remove operation of the Filesystem adapter, you can delete a file.
Name | Type | Direction | Description |
---|---|---|---|
name | String | in | Fully qualified file name of the file you want to remove, including the path. When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\". |
The adapter call does not return any messages. If the specified file does not exist, no error will be reported.