DosMove can be used to change only the name of a file or subdirectory, allowing the file object to remain in the same subdirectory. Global file-name characters are not allowed in the source or target name.

If the specified paths are different, the subdirectory location of the file object is changed also. If a drive is specified for the target, it must be the same as the one specified or implied by the source.

Attempts to move a parent subdirectory to one of its descendant subdirectories result in error code 251 (ERROR_DIRECTORY_IN_CDS) because a subdirectory cannot be both an ancestor and a descendant of the same subdirectory.

Attempts to move the current subdirectory or any of its ancestors for the current process, or any other process, will be rejected.

Attributes (times and dates) of the source file object are moved to the target. If read-only files exist in the target path, they are not replaced.

During initialization by an application, DosQuerySysInfo is called to determine the maximum path length allowed by the operating system.

DosMove can be used to change the case of a file on a drive that is controlled by a file system driver (FSD). The following example would change the name of the file to "File.Txt.".

DosMove("file.txt","File.Txt")


[Back] [Next]