# change-directory

Learn how to change the working directory.

This action sets the working directory for all actions that follow.

This is helpful when your workflow moves into a different folder, such as after scaffolding a project inside a subdirectory. For example, if you run [`execute-package`](/reference/cli/templates/actions/execute-package) to clone a starter template into a new folder, you can switch into that folder before executing [`install`](/reference/cli/templates/actions/install) or any additional setup steps.

## Example

The following template scaffolds a project and then changes into it:

**template.json5**

```json5
{
  "$schema": "https://schema.croct.com/json/v1/template.json",
  "title": "Project scaffold",
  "description": "Creates a project and switches to its directory.",
  "actions": [
    {
      "name": "execute-package",
      "command": "giget@latest",
      "arguments": ["gh:user/starter", "my-project"]
    },
    {
      "name": "change-directory",
      "path": "my-project"
    },
    {
      "name": "install"
    },
    {
      "name": "print",
      "semantics": "success",
      "message": "Project ready."
    }
  ]
}
```

To apply this template, run:

```sh
croct use template.json5
```

## Properties

These are the supported properties:

- `name`: `string`

  The action identifier. Always `change-directory` for this action.

- `path`: `string`

  The path to the new working directory.

  Can be relative or absolute.

## Explore

- [Execute package](/reference/cli/templates/actions/execute-package): Learn how to run a package binary command.
- [Run](/reference/cli/templates/actions/run): Learn how to run a group of actions.
