MSDN Library

Moving and Copying Files and Directories

Windows CE 3.0

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. You can use both CopyFile and MoveFile on directories. 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 or to copy a directory from one volume to another, place the file or directory in the object store as an intermediary step between the two volumes. Note that you cannot move a directory from one volume to another.

You can use also 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. This function works only on RAM-based files.

© 2016 Microsoft