FILE.COPY2 Function


Result as L = FILE.copy2(C source_filename ,C dest_filename [,L only_copy_if_newer ])



The path and name of the file to copy.


The path and name of the new file.


Default = .F. Alpha Anywhere checks to see that the source file is newer than the target file before it copies source to target.



Returns .T. if the copy succeeds, otherwise .F..


Same as File.Copy(), but if the dest_filename folder does not exist, then creates it.


The FILE.COPY2() method copies Source_Filename to the Destination_Filename. If you copy files between specific drives and directories, include the full drive and path with each filename. If the folder(s) for the target file does not yet exist, the method will create it.

You can use this method to duplicate any type of file, including tables, sets, and applications. However, to copy a table, set, or application you must remember to copy all related support files. For a table this can be up to six files: the table itself (.DBF), the memo file (.FPT), the index file (.CDX), and, if present, the three files that make up the data dictionary (.DDD, .DDM, .DDX). When copying tables it is easier to use the <TBL>.DUPLICATE() method instead, since duplicating a table automatically duplicates all support files and data dictionaries.

This statement copies a file into the data directory.


The function will create c:\backup if it does not exist and will create c:\backup\data if it does not exist.

See Also