move-path
Learn how to move or rename files and directories.
This action moves or renames a file or directory.
For example, you can rename .env.example to .env after scaffolding a project, relocate downloaded files to their final paths, or restructure directories during setup.
Example
The following template renames an example environment file:
template.json5
{ "$schema": "https://schema.croct.com/json/v1/template.json", "title": "Env setup", "description": "Renames the example environment file.", "actions": [ { "name": "move-path", "path": ".env.example", "destination": ".env" } ]}To apply this template, run:
npm
npx croct@latest use template.json5The source file is renamed to .env. If the destination already exists, the action fails unless overwrite is enabled.
Properties
These are the supported properties:
- namestring
The action identifier. Always move-path for this action.
- pathstring
The source path to move.
- destinationstring
The destination path.
- overwrite(optional)boolean
Whether to overwrite the destination if it already exists.
Default:false