rename

Renames a specified file

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:File System

Syntax

   #include <stdio.h>  
   #include <unistd.h> 
    
   int  rename  (  
      const char  *old,   
      const char  *new);
   

Parameters

old

(IN) Points to a string containing the full or relative path of the name of the file to be renamed (maximum 255 characters, including the NULL terminator).

new

(IN) Points to a string containing the full or relative path of the new file name to replace the old file name (maximum 255 characters, including the NULL terminator).

Return Values

Returns a value of 0 if successful, nonzero otherwise.

Remarks

NOTE:rename works only with the DOS and LONG name spaces. However, NWSetNameSpaceEntryName can rename files in other name spaces.

Wildcard specifiers are allowed for the old and new parameters.

rename can also rename directories. However, if a wildcard is specified, only matching files (not directories) are renamed.

The current connection number must have Modify privileges. If a wildcard is specified, the current connection must also have See File rights. To move a file, the current connection must have Delete and Read rights for the file to be moved and Create rights in the destination.

To move a directory requires Delete rights to the directory to be moved and Create in the destination. The above-mentioned rights are also required for all directories and files in the subdirectory tree. Additionally, Create, See File, and Read rights are required to move deleted files; without these rights, deleted files are purged.

See Also

FileServerFileCopy, NWGetNameSpaceEntryName, NWSetNameSpaceEntryName, SetCurrentNameSpace, SetTargetNameSpace