MOVE: Rename File

The source file is copied to the destination and the source is subsequently deleted.

Client Request
==================================
Description
=================================
UCHAR WordCount; Count of parameter words = 3
USHORT Tid2; Second (target) file id
USHORT OpenFunction; what to do if target file exists
USHORT Flags; Flags to control move operations:
0 - target must be a file
1 - target must be a directory
2 - reserved (must be 0)
3 - reserved (must be 0)
4 - verify all writes
USHORT ByteCount; Count of data bytes; min = 2
UCHAR Format1; 0x04
STRING OldFileName[]; Old file name
UCHAR FormatNew; 0x04
STRING NewFileName[]; New file name

OldFileName is copied to NewFileName, then OldFileName is deleted. Both OldFileName and NewFileName must refer to paths on the same server. NewFileName can refer to either a file or a directory. All file components except the last must exist; directories will not be created.

NewFileName can be required to be a file or a directory by the Flags field.

The tid in the header is associated with the source while tid2 is associated with the destination. These fields may contain the same or differing valid values. tid2 can be set to -1 indicating that this is to be the same tid as in the SMB header. This allows use of the move protocol with SMB_TREE_CONNECT_ANDX.

Server Response
==================================
Description
=================================
UCHAR WordCount; Count of parameter words = 1
USHORT Count; Number of files moved
USHORT ByteCount; Count of data bytes; min = 0
UCHAR ErrorFileFormat; 0x04 (only if error)
STRING ErrorFileName[]; Pathname of file where error occurred

The source path must refer to an existing file or files. Wildcards are permitted. Source files specified by wildcards are processed until an error is encountered. If an error is encountered, the expanded name of the file is returned in ErrorFileName. Wildcards are not permitted in newfilename.

OpenFunction controls what should happen if the destination file exists. If (OpenFunction & 0x30) == 0, the operation should fail if the destination exists. If (OpenFunction & 0x30) == 0x20, the destination file should be overwritten.

Errors

ERRDOS/ERRfilexists
ERRDOS/ERRbadfile
ERRDOS/ERRnoaccess
ERRDOS/ERRnofiles
ERRDOS/ERRbadshare
ERRHRD/ERRnowrite
ERRSRV/ERRnoaccess
ERRSRV/ERRinvdevice
ERRSRV/ERRinvid
ERRSRV/ERRbaduid
ERRSRV/ERRnosupport
ERRSRV/ERRaccess