qie.copyFile¶
Signature: qie.copyFile(sourceFile, destFile)
Returns: Boolean succeeded - true, if the file was successfully copied
Copies sourceFile to destFile.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String, File, or NetFile | sourceFile | the file to be copied. This can be either a string representing the file's full path and file name (i.e. 'c:\\temp\\file.txt'), a java.io.File object or a com.qvera.qie.utils.NetFile object. | |
| String, File, or NetFile | destFile | the file to be created. This can be either a string representing the file's full path and file name (i.e. 'c:\\temp\\file.txt'), a java.io.File object or a com.qvera.qie.utils.NetFile object. |
Example¶
// Example: sourceFile as String path, destFile as String path
if (!qie.copyFile(
"/tmp/mine.txt", // path to source file as String
"/tmp/theirs.txt" // path to destination file as String
)) {
// The copy failed -- handle it here (the destination may be missing or read-only).
}
// Example: sourceFile as File, destFile as File
var sourceFileObject = qie.newFile("/tmp/mine-file.txt");
var destFileObject = qie.newFile("/tmp/theirs-file.txt");
if (!qie.copyFile(
sourceFileObject, // java.io.File
destFileObject // java.io.File
)) {
// The copy failed -- handle it here.
}
// Example: sourceFile as String path, destFile as File
if (!qie.copyFile(
"/tmp/mine-mixed1.txt", // String
qie.newFile("/tmp/theirs-mixed1.txt") // java.io.File
)) {
// The copy failed -- handle it here.
}
// Example: sourceFile as File, destFile as String path
if (!qie.copyFile(
qie.newFile("/tmp/mine-mixed2.txt"), // java.io.File
"/tmp/theirs-mixed2.txt" // String
)) {
// The copy failed -- handle it here.
}