Expand my Community achievements bar.

Adobe Campaign User Groups are live now. Join our Adobe Campaign User Groups and connect with your local leaders!
SOLVED

File transfer activity - No suffix after download

Avatar

Level 3

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:

jorgeferreira_0-1696328513763.png

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!

 

1 Accepted Solution

Avatar

Correct answer by
Level 3

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.

View solution in original post

2 Replies

Avatar

Community Advisor

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/

Avatar

Correct answer by
Level 3

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.