![]() | Programming Guide | ![]() |
Copies a file and deletes its source
int sm_file_move(char *source, char *destination, char *mode);
source, destination- The paths of the file in its original and new locations.
sourceanddestinationmust be different file paths.
destinationmust include a file name; implicit copying to the same name as the source file yields an error. In three-tier applications, the path to source and destination can include a file access server ID in this format:[server-id!]pathIf you omit
server-id, Panther looks for the file locally.mode- Specifies whether to perform a text or binary copy; supply one of these arguments:
"b"
Binary transfer
"t"
Text transfer
sm_file_movecopies a file to the specified destination. If the destination file does not exist,sm_file_movecreates it; if it already exists, the function overwrites it. When the copy operation is complete, the function deletes the source file. Calling this function is equivalent to successive calls to sm_file_copy and sm_file_remove.In a three-tier environment, you can move files to and from remote file access servers by prefixing the file path with the server ID. For example, this JPL moves file
rpt.outfrom serveroakto the local machine:if sm_file_exists("oak!/disk/reports/rpt.out")
{
call sm_file_move \
("oak!/disk/reports/rpt.out", "c:\reports\rpt.out", "b")
}
sm_file_copy, sm_file_exists, sm_file_remove
![]()
![]()
![]()
![]()