Javascript
I'm trying to merge multiple CSV files into one and archive the originals using javascript in Adobe Campaign. The program runs without errors but doesn't seem to actually do anything. Can anyone help figure out why? Is this particular javascript code actually supported by adobe campaign? I have already checked the file paths and they are correct.
If my code is needed I will gladly post it, but first I need to know if these functions are even possible to use in javascript in adobe campaign.
Edit: Here is my code that I used:
// Defining the source and the archive directory
var home = '\\\\home\\files;
var dir = new File(home);
var files = dir.list("test_file_*.csv");
instance.vars.archiveDir = 'D:\\home\\files\\archive';
// Create a new combined file in the source directory
var combinedFile = new File(home + '\\combined.csv');
for each (var file in files) {
var filePath = home + '\\' + file.name;
// Check if file name contains the specific phrase
if (file.name.indexOf('test_file_') > -1) {
var data = File(filePath).read(); // Read each file content
combinedFile.write(data); // Write the content to the combined file
var archivePath = instance.vars.archiveDir + file.name;
file.move(archivePath); // Move file to archive
}
}
if (combinedFile.exists) {
logInfo('Combined file created at: ' + combinedFile.path);
}