Главная страница | назад





Article #17425: How do I move a file or directory?

 Question and Answer Database
FAQ2425C.txt How do I move a file or directory?
Category :Windows API
Platform :All
Product :C++Builder 3.x
Question:
How do I move a file or directory?
Answer:
You can use the Windows API function MoveFile() to move a file or
directory. If you move a file, it must not already exist in the
destination directory however the destination file may be located on a
different drive. If you are moving an entire directory, all child sub
directories will also be moved, and the destination directory must be
located on the same drive or volume as the source.
Example:
To move a file:
MoveFile("C:\\Source\\sourcefile.txt", "C:\\Dest\\destfile.txt");
To move a directory:
MoveFile("C:\\Source", "C:\\Dest");
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99