> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# fileCreate

> ディスク上の指定されたパスにファイルを作成し、オプションでデータを書き込みます。エンコーディングや書き込みモードを制御できます。

ディスクの特定のパスにファイルを作成し、オプションでファイルに書き込みます。

## 必要なパラメータ

* **file**：作成するファイルのフルパス（filename 含む）。

## オプションのパラメータ

* **force**：オペレーションが**file** パラメータに設定したパスに見つからないディレクトリを作成するかどうかを制御。`true` および`false` が使用可能です。デフォルト値は`true` です。
* **data**：ファイルに書き込むデータ。
* **mode**：書き込みのモード。`truncate` および`append` が使用可能です。デフォルトは`truncate` で、ターゲットファイルがすでに存在する場合はファイルの内容を上書きします。
* **encoding**：ファイルを作成するときに使用するエンコーディング。許容される値は、使用されているJVM / OS によって決まります。デフォルトは`UTF-8` です。

## アウトプット属性

* **file:file**：作成されたファイルのフルパス。
* **file:cdate**：ファイルの作成日。

## 例

```xml theme={null}
<!-- Setting the file location and data on the input item -->
<arc:set attr="input.file" value="/tmp/myfiles/cars.json"/>
<arc:setc attr="input.data">{
  "Cars": [
    {
      "Make": "Toyota",
      "Model": "Camry",
      "Type": "Sedan"
    },
    {
      "Make": "Toyota",
      "Model": "Corolla",
      "Type": "Sedan"
    }
  ]
}
</arc:setc>

<!-- Calling fileCreate and passing in the input item -->
<arc:call op="fileCreate" in="input" out="result">
  <!-- Optional: Logging information about the created file to the application log -->
	<arc:set attr="_log.info" value="A file with the timestamp of [result.file:cdate] was created and written to this path: [result.file:file]"/>  
</arc:call> 
```
