Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NiFi PutFile manipulate lastModifiedTime

avatar

Hi all, i need some help with this behaviour. I have 2 processors (GetFTP > PutFTP) and i had a trouble with the manipulation about the lastModifiedTime, i need to set the original date of the sourcefile when i do the PutFTP .

i had let the property unset but the attribute lastModifiedTime has change.

Nifi version 1.4.0-rc2

The documentation saids:

45672-putftp-conf.png

The lastModifiedTime to assign to the file after transferring it. If not set, the lastModifiedTime will not be changed. Format must be yyyy-MM-dd'T'HH:mm:ssZ. You may also use expression language such as ${file.lastModifiedTime}. If the value is invalid, the processor will not be invalid but will fail to change lastModifiedTime of the file.
Supports Expression Language: true

Regards

45670-sourcefile.png

45671-destfile.png

4 REPLIES 4

avatar
Master Guru
@Gonzalo Salvia

Scenario 1:-

In your PutFTP processor change

Last Modified Time property to

${file.lastModifiedTime}

If we mention the property value as above in putftp processor configurations then the new file(push test directory) will have same lastmodifiedtime as the sourcefile.

Configs:-

45675-putftp.png

Scenario 2:-

If we keep the Last Modified Time property as Blank(same configurations as mentioned in your question)

Then putftp processor will set last modified time of the file as new time(not the source file last modified time).

When we pulls the file from the Destination directory(push test) we are going to see the Different last modified times compared to source file(pull test) last modified time.

I think you are facing scenario 2 to get same last modified time as source file just change the property as suggested above in Scenario 1.

Then compare the Last Modified Times between source file(pull test) with destination file(push test), they are going to be same.

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.

avatar

Hi Shu, thanks for your answer.

i had tried your advice setting the ${file.lastModifiedTime} but the processor raise this warning and set the execution date as the lastModifiedTime on the destination file .

47393-warning.png

Regards

avatar

Hi @Shu

After read this warning and review in detail the code of the PutFile Processor, i had find line 394:

// FTP server probably doesn't support MFMT command

So i guess that this behaviour its related with the vsftpd server (version 3.0.3). I will test another ftpserver.

Regards

avatar
New Contributor

How to do this for putHDFS processor? I don't see any Last Modified Time property in that.