truncate
Shrink or extend file size to exact bytes with dry-run preview and overwrite protection. Returns old and new size. Use for programmatic file resizing.
Instructions
Shrink or extend file sizes to an exact byte length with dry-run and overwrite protection. Destructive: modifies file content — shrinking discards data, extending fills with null bytes. Use --dry_run to preview. Returns JSON with old and new file size. Use to resize files programmatically. Not for timestamp-only updates — use 'touch'. Not for block-level copying — use 'dd'. See also 'touch', 'dd'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | Report operations without changing files. | |
| no_create | No | Fail if a target file does not exist. | |
| parents | No | Create missing parent directories. | |
| paths | Yes | Files to resize. | |
| size | No | Target size in bytes. |