Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
RENAMEFILEQQ
Portability Function: Renames a file or directory.
Module
USE IFPORT
result = RENAMEFILEQQ (oldname,newname)
oldname  |  
      (Input) Character*(*). Current name of the file or directory to be renamed.  |  
     
newname  |  
      (Input) Character*(*). New name of the file or directory.  |  
     
Results
The result type is LOGICAL(4). The result is .TRUE. if successful; otherwise, .FALSE..
You can use RENAMEFILEQQ to move a file from one directory to another on the same drive by giving a different path in the newname parameter.
If the function fails, call GETLASTERRORQQ to determine the reason. One of the following errors can be returned:
ERR$ACCES - Permission denied. The file's or directory's permission setting does not allow the specified access.
ERR$EXIST - The file or directory already exists.
ERR$NOENT - File or directory or path specified by oldname not found.
ERR$XDEV - Attempt to move a file or directory to a different device.
Example
 USE IFPORT
 USE IFCORE
 INTEGER(4) len
 CHARACTER(80) oldname, newname
 LOGICAL(4) result
 WRITE(*,'(A, \)') ' Enter old name: '
 len = GETSTRQQ(oldname)
 WRITE(*,'(A, \)') ' Enter new name: '
 len = GETSTRQQ(newname)
 result = RENAMEFILEQQ(oldname, newname)
 END