SFTP Version 6: 8.3. Removing and Renaming Files
byte SSH_FXP_RENAME
uint32 request-id
string oldpath [UTF-8]
string newpath [UTF-8]
uint32 flags
where 'request-id' is the request identifier, 'oldpath' is the name
of an existing file or directory, and 'newpath' is the new name for
the file or directory.
'flags' is 0 or a combination of:
SSH_FXF_RENAME_OVERWRITE 0x00000001
SSH_FXF_RENAME_ATOMIC 0x00000002
SSH_FXF_RENAME_NATIVE 0x00000004
If the server cannot support the requested mode of operation, it must
return SSH_FX_OP_UNSUPPORTED.
If flags does not include SSH_FXP_RENAME_OVERWRITE, and there already
exists a file with the name specified by newpath, the server MUST
respond with SSH_FX_FILE_ALREADY_EXISTS.
If flags includes SSH_FXP_RENAME_ATOMIC, and the destination file
already exists, it is replaced in an atomic fashion. I.e., there is
no observable instant in time where the name does not refer to either
the old or the new file. SSH_FXP_RENAME_ATOMIC implies
SSH_FXP_RENAME_OVERWRITE.
If 'SSH_FXP_RENAME_OVERWRITE' is not present, and the server does not
support this mode natively, it MAY emulate it by checking for the
existance of a file before executing the rename operation.
If the 'SSH_FXF_RENAME_ATOMIC' is specified without the the
'SSH_FXP_RENAME_OVERWRITE', then the server MUST be able to perform
the check and rename operation atomically.
Because some servers cannot provide atomic rename, clients should
only specify atomic rename if correct operation requires it. If
SSH_FXP_RENAME_OVERWRITE is specified, the server MAY perform an
atomic rename even if it is not requested.
If flags includes SSH_FXP_RENAME_NATIVE, the server is free to do the
rename operation in whatever fashion it deems appropriate. Other
flag values are considered hints as to desired behavior, but not
requirements.
The server will respond to this request with a SSH_FXP_STATUS
message.
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Standard: netstandard2.0, netstandard2.1
.NET Framework: net20, net35, net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.