Share via


Moving and Copying Files and Directories (Windows CE 5.0)

Send Feedback

Use the CopyFile and MoveFile functions to copy and move files, respectively. Both functions receive the name of the file to copy or move in their respective lpExistingFileName parameters, and they copy or move the file to the location that is described in their respective lpNewFileName parameters. CopyFile contains the bFailIfExists parameter, which lets you determine if you want CopyFile to copy over a file if a version of the file exists in the target directory. MoveFile does not have a corresponding pFailIfExists parameter; instead, MoveFile automatically fails if the file already exists in the target directory.

Only MoveFile can be used on directories, not CreateFile. Using MoveFile on a directory moves all of the files and subdirectories within that directory.

The CopyFile and MoveFile functions can copy and move a file within the object store, from a mounted drive to the object store, or from the object store to a mounted drive. To copy or move a file from one volume to another, place the file in the object store as an intermediary step between the two volumes. You cannot move a directory from one volume to another.

You can also use the DeleteAndRenameFile function to move a file from one directory to another. Like the MoveFile function, DeleteAndRenameFile deletes a file after moving that file to another directory. However, you have the option of renaming the new version of the file.

See Also

File System Operations

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.