| sourceUri | string | Yes | URI of the file or directory to copy, for example, **datashare:///media/file/102**. |
| sourceUri | string | Yes | URI of the file or directory to copy, for example, **file://media/file/102**. |
| destUri | string | Yes | URI of the destination directory, for example, **datashare:///media/file/101**. |
| destUri | string | Yes | URI of the destination directory, for example, **file://media/file/101**. |
| force | boolean | No | Whether to forcibly overwrite the file with the same name. <br>If **force** is **true**, the file with the same name will be overwritten. If **force** is **false** or not specified, the file with the same name will not be overwritten.|
| force | boolean | No | Whether to forcibly overwrite the file with the same name. <br>If **force** is **true**, the file with the same name will be overwritten. If **force** is **false** or not specified, the file with the same name will not be overwritten.|
**Return value**
**Return value**
...
@@ -1582,8 +1582,8 @@ Example 1: Copy a file with **force** unspecified.
...
@@ -1582,8 +1582,8 @@ Example 1: Copy a file with **force** unspecified.
// The media library URI is used as an example.
// The media library URI is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// You can use the URI obtained.
// You can use the URI obtained.
letsourceFile="datashare:///media/file/102";
letsourceFile="file://media/file/102";
letdestFile="datashare:///media/file/101";
letdestFile="file://media/file/101";
try{
try{
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
@@ -1608,8 +1608,8 @@ Example 2: Copy a file or directory when **force** set to **true**.
...
@@ -1608,8 +1608,8 @@ Example 2: Copy a file or directory when **force** set to **true**.
// The media library URI is used as an example.
// The media library URI is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// You can use the URI obtained.
// You can use the URI obtained.
letsourceFile="datashare:///media/file/102";
letsourceFile="file://media/file/102";
letdestFile="datashare:///media/file/101";
letdestFile="file://media/file/101";
try{
try{
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
| sourceUri | string | Yes | URI of the file or directory to copy, for example, **datashare:///media/file/102**. |
| sourceUri | string | Yes | URI of the file or directory to copy, for example, **file://media/file/102**. |
| destUri | string | Yes | URI of the destination directory, for example, **datashare:///media/file/101**. |
| destUri | string | Yes | URI of the destination directory, for example, **file://media/file/101**. |
| callback | AsyncCallback<Array<[CopyResult](#copyresult10)>> | Yes | Callback invoked to return the result. If the file or directory is copied successfully, no information is returned. If the file copy fails, **copyResult** is returned.|
| callback | AsyncCallback<Array<[CopyResult](#copyresult10)>> | Yes | Callback invoked to return the result. If the file or directory is copied successfully, no information is returned. If the file copy fails, **copyResult** is returned.|
**Example**
**Example**
...
@@ -1652,8 +1652,8 @@ Copies a file or directory. This API uses an asynchronous callback to return the
...
@@ -1652,8 +1652,8 @@ Copies a file or directory. This API uses an asynchronous callback to return the
// The media library URI is used as an example.
// The media library URI is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// You can use the URI obtained.
// You can use the URI obtained.
letsourceFile="datashare:///media/file/102";
letsourceFile="file://media/file/102";
letdestFile="datashare:///media/file/101";
letdestFile="file://media/file/101";
try{
try{
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
| sourceUri | string | Yes | URI of the file or directory to copy, for example, **datashare:///media/file/102**. |
| sourceUri | string | Yes | URI of the file or directory to copy, for example, **file://media/file/102**. |
| destUri | string | Yes | URI of the destination directory, for example, **datashare:///media/file/101**. |
| destUri | string | Yes | URI of the destination directory, for example, **file://media/file/101**. |
| force | boolean | Yes | Whether to forcibly overwrite the file with the same name. <br>If **force** is **true**, the file with the same name will be overwritten. If **force** is **false** or not specified, the file with the same name will not be overwritten.|
| force | boolean | Yes | Whether to forcibly overwrite the file with the same name. <br>If **force** is **true**, the file with the same name will be overwritten. If **force** is **false** or not specified, the file with the same name will not be overwritten.|
| callback | AsyncCallback<Array<[CopyResult](#copyresult10)>> | Yes | Callback invoked to return the result. If the file or directory is copied successfully, no information is returned. If the file copy fails, **copyResult** is returned.|
| callback | AsyncCallback<Array<[CopyResult](#copyresult10)>> | Yes | Callback invoked to return the result. If the file or directory is copied successfully, no information is returned. If the file copy fails, **copyResult** is returned.|
...
@@ -1702,8 +1702,8 @@ Copies a file or directory. This API uses an asynchronous callback to return the
...
@@ -1702,8 +1702,8 @@ Copies a file or directory. This API uses an asynchronous callback to return the
// The media library URI is used as an example.
// The media library URI is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// You can use the URI obtained.
// You can use the URI obtained.
letsourceFile="datashare:///media/file/102";
letsourceFile="file://media/file/102";
letdestFile="datashare:///media/file/101";
letdestFile="file://media/file/101";
try{
try{
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.
// Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper.