3.2.4.10 Application Requests Renaming a File or Set of Files

The application provides:

  • The Client.TreeConnect representing the share in which the file(s) to be renamed exist(s).

  • The attribute mask of the file(s) to be renamed.

  • The pathname of the file(s) to be renamed.

  • The new desired pathname of the file(s).

  • A valid Client.Session.

To rename the file, the client MUST issue one of the following command requests:

  • SMB_COM_NT_RENAME (section 2.2.4.66.1) (Obsolescent)

    The client MUST construct an SMB_COM_NT_RENAME Request (section 2.2.4.66.1) message with the following additional requirements:

    • The SMB_Parameters.Words.SearchAttributes field MUST contain the attribute mask supplied by the application.

    • The SMB_Data.Bytes.OldFileName field MUST contain the source pathname supplied by the application.

    • The SMB_Data.Bytes.NewFileName field MUST contain the destination pathname supplied by the application.

    • The SMB_Parameters.Words.InformationLevel field MUST contain an information level value of SMB_NT_RENAME_RENAME_FILE.

      SMB_COM_NT_RENAME does not support wildcards and does not support renaming multiple files. This command provides support for the creation of hard links (see section 3.2.4.11).

  • SMB_COM_RENAME (section 2.2.4.8)

    The client MUST construct an SMB_COM_RENAME Request (section 2.2.4.8.1) message with the following additional requirements:

    • The SMB_Parameters.Words.SearchAttributes field MUST contain the attribute mask supplied by the application.

    • The SMB_Data.Bytes.OldFileName field MUST contain the source pathname supplied by the application.

    • The SMB_Data.Bytes.NewFileName field MUST contain the destination pathname supplied by the application.

      SMB_COM_RENAME can be used to rename multiple files if the file name (the final component of the FileName field) contains wildcard characters. The SearchAttributes are used to modify the set of files that MAY be included in the rename operation.

Either of the preceding commands can be used to rename a file.

The request MUST be sent to the server as specified in section 3.2.4.1.