Rename a file or directory and update permissions
Note that this method will fail if pathname given by $newName argument already exists.
Available since version 3.0.118.
Usage
// basic usage
$bool = $files->rename(string $oldName, string $newName);
// usage with all arguments
$bool = $files->rename(string $oldName, string $newName, $options = []);
Arguments
Name | Type(s) | Description |
---|---|---|
oldName | string | Old pathname, must be full disk path. |
newName | string | New pathname, must be full disk path OR can be basename to assume same path as $oldName. |
options (optional) | array, bool, string | Options array to modify behavior or substitute
|
Return value
bool
True on success, false on fail (or WireException if throw option specified).
Exceptions
Method can throw exceptions on error:
WireException
- If error occurs and $throw argument was true.
API reference based on ProcessWire core version 3.0.236