Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!

Update only if file was created/modified today?

Avatar

Level 4

We're reading a file from SFTP. 

This file is called file.csv every day. We only need to load its data if it is a new file, e.g. created or modified today. 

Is it possible to check the metada of a file within Campaign? 

2 Replies

Avatar

Community Advisor

Hello @ogonzalesdiaz 

 

You will have to use a javascript code before uploading the file to check if the file date is before today or not.

 

The code to get the modified date of a file is this:

var PATH=getOption("SFTP_UploadFolder");
var FOLDER_PATH=PATH+"/FILE_NAME.csv";

var myFile = new File(FOLDER_PATH);
 
logInfo(myFile.lastModified); // this will return the modified date

 


     Manoj
     Find me on LinkedIn

Avatar

Level 4

@_Manoj_Kumar_  actually the last line gives error: 

BAS-010034 Unable to change date of file 'path_of_file/file.csv.gz'.