Futurebasic/Language/Reference/usr copyfile

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USR COPYFILE(SrcName$, SrcVol%, SrcDir&, ¬ DestName$, DstVol%, DstDir&)

Revised FEBRUARY, 2002 (Release 6)

Description - This function copies a file from one location to another. If the copy is successful, the function returns _noErr (zero). If the copy fails, a file error code is returned. In the process of this operation, the original file is left intact. The source and destination folders may be the same if the file name is different.

Example:

The following example allows the user to select a file and a new destination before calling the USR COPYFILE function.

INCLUDE "Util_Files.incl" DIM filename$,folderName$,destName$ DIM @vRefNum%,destVref% DIM err fileName$ = FILES$(_fOpen,,"Select a file to move",vRefNum) LONG IF LEN(fileName$)

  folderName$ = FILES$(_fFolder,,,destVref%)    LONG IF LEN(folderName$)

destName$ = "Copy of" + filename$ err = USR COPYFILE(fileName$, vRefNum, ¬ 0, destName$, destVref, 0) LONG IF err PRINT "File was not copied." XELSE PRINT "File copy successful." END IF

  END IF

END IF

LOTS OF MUMBO JUMBO!!!

See Also USR MOVEFILE; RENAME; FILES$