Hello!

I need to set Last Modified Time in PutFile however I cannot use 
file.creationTime as it is retrieved from either ListFile or GetFile.

I am retrieving files from a folder in the middle of my flow using FetchFile 
and passing the absolute path to the files (as ListFile and GetFile have no 
input connections).
After FetchFile I retrieve the file metadata with ls - l --time-style=full-iso 
which outputs something like this:

-rw-r--r--   1 nifi nifi 60 2020-02-14 14:14:07.000000000 +0000 file.txt

>From this I retrieve all components of the date and time that are needed and 
>merge them together with the following:

fileMetadata.6   value:2020-02-14
fileMetadata.7  value:14:14:07.000000000
fileMetadata.8  value:+0000

dateMetadata  value:${fileMetadata.6:append(' 
'):append(${fileMetadata.7:substringBefore('.')})}
Last Modified Time  value:${dateMetadata:replace(' ', 'T'):append(' 
'):append(${fileMetadata.8}):toDate("yyyy-MM-dd'T'HH:mm:ssZ")}

After this I expect the following value for Last Modified Time    
2020-02-14T14:14:07 +0000    which should correspond to the format required in 
the PutFile processor (yyyy-MM-dd'T'HH:mm:ssZ).
Instead, after the above I obtain  Fri Feb 14 15:10:56 CET 2020  which makes me 
think that there is some other transformation taking place which I am not aware 
of.
When  the above value Fri Feb 14 15:10:56 CET 2020 is used in the Last Modified 
Time I get the following error message:

Could not set file lastModifiedTime to Fri Feb 14 15:10:56 CET 2020 because 
unparsable date:Fri Feb 14 15:10:56 CET 2020

So I am wondering what I could do to address this issue and if there is another 
transformation taking place.

Thanks in advance & all the best

Valentina

Reply via email to