Rename Asset (zeysdk rename)
Rename an existing asset while maintaining its configuration in your ZeyOS application.
zeysdk rename <ASSET_CLASS>/<OLD_FILENAME> <ASSET_CLASS>/<NEW_FILENAME> [options]
Parameters
| Parameter | Description | Required | Example |
|---|---|---|---|
<ASSET_CLASS>/<OLD_FILENAME> | Source asset path | ✅ | services/old-backup.ixml |
<ASSET_CLASS>/<NEW_FILENAME> | Destination asset path | ✅ | services/new-backup.ixml |
Options
| Option | Description | Default |
|---|---|---|
--verbose | Show detailed progress output | false |
Validation Rules
-
Source Validation
- Asset class must be valid (
services,resources,weblets) - Source file must exist in
zeyos.app.json - Source file must exist in filesystem
- Asset class must be valid (
-
Destination Validation
- Asset classes must match between source and destination
- Destination must not already exist
- New filename must be valid
-
Configuration
zeyos.app.jsonmust exist- Asset must be properly configured
Examples
# Rename a service
zeysdk rename services/old-backup.ixml services/new-backup.ixml --verbose
# Output:
# Loading assets info.
# Updating assets info.
# Renaming file.
# Rename was completed successfully.
# Rename a weblet (changing extension)
zeysdk rename weblets/dashboard.ixml weblets/dashboard-test.ixml
# Updates mimetype automatically
# Rename a resource
zeysdk rename resources/old-logo.png resources/new-logo.png
Error Handling
| Error | Description | Resolution | Example Message |
|---|---|---|---|
| Invalid arguments | Missing parameters | Provide both paths | expects at least 2 arguments |
| Asset class mismatch | Different classes | Use same class | expects the <ASSET_CLASS> directory to be the same |
| Invalid asset class | Wrong type | Use valid class | should be a valid <ASSET_CLASS>: services, resources, weblets |
| Missing config | No app.json | Initialize app | requires the zeyos.app.json file to exist |
| Source missing | Source not found | Check source path | requires the asset to exist |
| Destination exists | Target exists | Choose different name | requires the destination file to not exist |
| Rename failed | File system error | Check permissions | There was a problem renaming the file |
Automatic Updates
The following are automatically handled:
- MIME type updates based on new extension
- Configuration key updates
- File system changes
- Backup creation and restoration
- Validation checks