Hello,
Is it possible to disable the suffix added to the downloaded files on the File transfer activity?
The file "attach1.pdf" downloaded like this:
The filename afterwards will be: attach1_20231003101346a.pdf.
I can remove the suffix via JS code, but I'm wondering if there's any way to remove this suffix.
Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
With Marcel's suggestion in mind, I ended up using the copyTo method from the File Class (experienceleague.adobe.com/developer/campaign-api/api/m-File-copyTo.html)
This way, it's transversal between operating systems.
Hello @jorgeferreira,
I think this cannot be turned off.. MIght be.. but you need to work with vars.filename and use js and shell script to rename file if needed.
//vars.filename = "atach1_29509ulkjflr390ru.pdf"
var matches = vars.filename.match(/([^_]+)(?=_)(_.+\.([^.]+))/);
if (matches && matches.length === 4) {
var fileBaseName = matches[1],
extension = matches[3],
fileName = fileBaseName + "." + extension;
logInfo("Filename:", fileName); // This will output: Filename: atach1.pdf
try{
//in case you use linux based OS
execCommand('mv "/path/to/your/'+vars.filename + ', "/path/to/your/'+ filename+'"', true);
}catch(e){
//handle error
}
}
EDIT: I have not checked if vars.filename contains path as well. but if it does then you would change the code a bit to extract path, filename and extension.
Marcel Szimonisz
MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/
With Marcel's suggestion in mind, I ended up using the copyTo method from the File Class (experienceleague.adobe.com/developer/campaign-api/api/m-File-copyTo.html)
This way, it's transversal between operating systems.
Views
Likes
Replies