|
MoveFile
|
|
|
The MoveFile method moves specified file to the new location.
C++
long MoveFile(
LPSTR SourceFileName, // source file name
LPSTR DestFileName, // destination file name
BOOL Overwrite = FALSE // overwrite flag
);
long MoveFile(
LPWSTR SourceFileName, // source file name
LPWSTR DestFileName // destination file name
BOOL Overwrite = FALSE // overwrite flag
);
BASIC
MoveFile(
SourceFileName As Variant, // source file name
DestFileName As Variant, // destination file name
Overwrite As Boolean = False // overwrite flag
) As Long
Parameters
- SourceFileName
-
C++
Pointer to buffer containing name of the source file (must be NULL terminated).
BASIC
Variant containing name of the source file.
Variant must be of String data type; it must not be an array.
- DestinationFileName
-
C++
Pointer to buffer containing name of the destination file (must be NULL terminated).
BASIC
Variant containing name of the destination file.
Variant must be of String data type; it must not be an array.
- Overwrite
-
Overwrite flag that determines behaviour of the method when destination file exists.
If this parameter is FALSE and destination file exists, method returns with error.
Return Values
If the method succeeds, the return value is 0.
If the method fails, the return value is failure code and error code is set.
Call GetError to get error code.
Remarks
Method operates on files only - if SourceFileName or DestFileName specifies directory, method returns with error.
SourceFileName and DestinationFileName can be specified as either absolute or relative path.
Method can be also used to rename file if both source and destination file is located in the same directory.
Unicode version of the method should not be confused with Unicode system calls or Unicode text data.
All versions of the method can be used on Unicode and non-Unicode systems depending on your needs. On Unicode systems, however,
file is moved using Unicode version of system function (unless Unicode is disabled with EnableUnicode method).
Conversion between ANSI and Unicode is performed internally according to current codepage which can be changed with SetCodePage method.
See Unicode Support for more information on Unicode system calls, Unicode methods and Unicode text data.
See Also
CopyFile,
File System Operations