If the file contents is the message object, the simplest way would be to add an additional File Destination and specify the path.
If you do need to construct the path, and copy a separate file from one location to another, I would use the apache FileUtils like this:
var FileUtils = org.apache.commons.io.FileUtils;
File = java.io.File;
// create output filename
var fromFilename = "C:" + File.separator + "Qvera" + File.separator + "In" + File.separator + "one.data";
var fromFile = new java.io.File(fromFilename);
// create output filename
var toFilename = "C:" + File.separator + "Qvera" + File.separator + "Out" + File.separator + "one.data";
var toFile = new java.io.File(toFilename);
// Copy the file to the new destination
if (fromFile.exists()) {
try {
FileUtils.copyFile(fromFile, toFile);
qie.info('copied to ' + toFilename);
} catch (err) {
qie.warn('Caught error trying to copy file: ' + err);
}
} else {
qie.info(fromFilename + ' does not exist.');
}
You can remove the extra qie.info logging once it is working the way you want. Also note, it is a good idea to use the File.separator value, which will use a \ for windows and a / for linux.