Media_CopyItem ( source ; dest ; replace )
Media_CopyItem copies a file or folder to a new location, optionally replacing any same-named items in the destination.
Parameter | Description |
---|---|
source | The path or container reference to the folder or file to be copied |
dest |
The path or container reference to either:
|
replace | When set to “1”, an item in Destination with the same name will be replaced. When “0” an error will be generated if copying would replace an existing item. |
Caution
Items replaced by this function when Replace is 1 cannot be recovered. Use 0 for the Replace parameter unless you wish to allow this.
Examples
To copy a file named “Contacts.doc” from the Desktop to the root folder:
Set Field [ MyTable::Response ;
Media_CopyItem (
".D/Contacts.doc" ;
".R" ;
0 ) ]
To copy a file named “Contacts.doc” from the Desktop to the root folder, replacing any other file with the same name that might already exist in the root folder:
Set Field [ MyTable::Response ;
Media_CopyItem (
".D/Contacts.doc" ;
".R" ;
1 ) ]
To copy a file named “invoices.fmp12” from the default folder to a folder named “My Files” on the Desktop:
Set Field [ MyTable::Response ;
Media_CopyItem (
"invoices.fmp12" ;
".D/My Files" ;
0 ) ]
To copy a file named “fred.gif” from the default folder to the root folder while renaming it to “barney.gif”:
Set Field [ MyTable::Response ;
Media_CopyItem (
"fred.gif" ;
".R/barney.gif" ;
0 ) ]