Moving a Text File to SFTP

Avatar

Avatar

rahulg1930481

Avatar

rahulg1930481

rahulg1930481

03-08-2018

Hello

I was wondering if someone can show me how to create a text file with any dynamic content and move it to SFTP. Currently I am able to move only text files or CSVs containing any query results to sftp.

I am using Adobe Campaign Classic v6.7. The SFTP that I am trying to move is the one that came with the Adobe Campaign.

Thanks,

Ganesh

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Vapsy

Employee

Avatar

Vapsy

Employee

Vapsy
Employee

04-08-2018

HI Ganesh,

You can do so in a JS activity.

I have a query activity of which I'm trying to create a file. You can adapt it to your scenario

var query = xtk.queryDef.create(

  <queryDef schema="temp:query" operation="select">

    <select>

      <node expr="@deliveryId"/>

      <node expr="@broadLogId"/>

    </select>

  </queryDef>);

var result = query.ExecuteQuery();

// Create the txt file

var f = new File("/sftp/<customerName>/incoming/MyFolder/myFile.txt");

// Open file on Write mode

f.open("w");

for each (var record in result) {

     

    // Write on the file

    f.writeln(record.@deliveryId + "," + record.@broadLogId);

     

    } // end for

     

// Close file

f.close();

The file has been created on Adobe sFTP inside MyFolder

Regards,
Vipul

Answers (0)