dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosMove (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSFILEMGR
 
USHORT DosMove(pszOldName, pszNewName, ulReserved)
PSZ pszOldName;      /* pointer to old path and filename */
PSZ pszNewName;      /* pointer to new path and filename */
ULONG ulReserved;    /* must be zero                     */
 
The DosMove function moves a specified file to a specified new directory
and/or filename. The function is often used to rename an existing file by
moving the file to a new filename location in the same directory. The
function can also be used to move a file to a new directory while preserving
the existing filename or to rename any directory that is not the root
directory.
 
The DosMove function is a family API function.
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
pszOldName  Points to a null-terminated string. This string specifies the
            current filename of the file to be moved. The string must be a
            valid MS OS/2 filename.
 
pszNewName  Points to a null-terminated string. This string specifies the
            new directory and filename of the file to be moved. The string
            must be a valid MS OS/2 filename.
 
ulReserved  Specifies a reserved value; must be zero.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
 
     ERROR_ACCESS_DENIED
     ERROR_DRIVE_LOCKED
     ERROR_FILE_NOT_FOUND
     ERROR_NOT_DOS_DISK
     ERROR_NOT_SAME_DEVICE
     ERROR_PATH_NOT_FOUND
     ERROR_SHARING_BUFFER_EXCEEDED
     ERROR_SHARING_VIOLATION
 
Comments
 
The DosMove function cannot move a file from one drive to another; if a
drive is used in the pszOldName string, the same drive must be used in the
pszNewName string.
 
Wildcard characters are not allowed in the filename.
 
Example
 
This example calls the DosMove function to move the file abc to the root
directory of the current drive and to rename the file xyz. This does not
copy the file, but it may change the subdirectory that the filename appears
in and may change the filename itself.
 
DosMove("abc",            /* old filename and path */
    "\\xyz",              /* new filename and path */
    0L);                  /* reserved              */
 
See Also
 
DosCopy, DosDelete, DosSelectDisk