You can use the Filesystem adapter to write data to a file in the filesystem.
Multiexcerpt include |
---|
SpaceWithExcerpt | INTERNAL |
---|
MultiExcerptName | FilesystemAdapter_ProductExport_Example |
---|
PageWithExcerpt | INTERNAL:_designer_examples |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
Writing a File
Using the write operation of the Filesystem adapter, you can write a file to the filesystem.
Multiexcerpt include |
---|
MultiExcerptName | write |
---|
PageWithExcerpt | Filesystem |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
Replacing the File
Specifying only data and length (optionally), you can write a complete file. If the file is already existing, it will be overwritten with the new content.
Writing Data to a Specified Position in the File
Alternatively, you can use the write operation with the position to write data to a specific position. position defines the byte position within a file to which the new content should be written. Depending on the length of the new data, this will result in a partly update of the file content, and/or an extension of the file.
Find a list of all File System Adapter error codes on System Errors of the File System Adapter.
Error Code | Description |
---|
FSASDM/22 | Failed creating file. Either the directory where the file should be written to, is missing, or the filename is too long (Windows limitation). |
Appending Data to a File
Using the append operation of the Filesystem adapter, you can append data to a file in the filesystem.
Multiexcerpt include |
---|
MultiExcerptName | append |
---|
PageWithExcerpt | Filesystem |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
Modes
You can use the append operation with two modes:
- append
If the mode is empty or append, the content stored in data will be appended to the end of the file specified in name. If the file does not exist, it will be created. - overwrite
If mode is overwrite, the file specified in name will be overwritten with the content stored in data. If the file does not exist, it will be created.
overwrite will only be applied to the first append. For all subsequent appends (e.g. in a loop), the mode will be switched to append automatically.
Closing a File
Multiexcerpt include |
---|
MultiExcerptName | closeFile |
---|
PageWithExcerpt | Reading a File |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|