Update only if file was created/modified today? | Community
Skip to main content
Level 6
February 5, 2024
Question

Update only if file was created/modified today?

  • February 5, 2024
  • 1 reply
  • 560 views

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? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Manoj_Kumar
Community Advisor
Community Advisor
February 5, 2024

Hello @god_prophet 

 

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
Level 6
February 6, 2024

@_manoj_kumar_  actually the last line gives error: 

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