Skip to main content

File System Task Configuration (fs)

Copy other files into project

The "fs" task is used to perform filesystem operations within your configuration. It allows you to copy files from one location to another within your project. This task is particularly useful when you need to manage project assets, configuration files, or other resources.

Task Properties

PropertyTypeDescription
task"fs", requiredSpecifies the task type, which should be set to "fs" for this task.
namestringAn optional name for the task. If provided, the task state will be saved as a variable. Visit Task and Action States page to learn more.
labelstringAn optional label or description for the task.
whenobjectVisit Conditional Tasks and Actions page to learn how to execute task conditionally.
actionsArray<Action>, requiredAn array of action items that define the modifications to be made in the file.

Action Properties

PropertyTypeDescription
namestringAn optional name for the task. If provided, the task state will be saved as a variable. Visit Task and Action States page to learn more.
whenobjectVisit Conditional Tasks and Actions page to learn how to execute action conditionally.
copyFilestringA string that specifies the name of the file needed to be copied.
destinationstring, requiredA relative path from the project's root directory specifying the destination where the file will be copied. This field determines where the copied file will be placed within your project's directory structure.
messagestringA string that serves as the user prompt message when collecting input. If provided, this message will replace the default message.

Usage Example

Here's an example of how to use the "fs" task in a configuration file:

steps:
- task: fs
actions:
- copyFile: "example.txt"
message: "Please enter the path of the file you want to copy:"
destination: "assets/example.txt"

In this example:

  • We define an "fs" task to copy a file named "example.txt".
  • We customize the user prompt message to request the path of the file to copy.
  • The destination field specifies that the file should be copied to the "assets/example.txt" path within the project's root.