"Files/Folders Meta Info" node can not get last modified date correctly in the Business Hub

Hello everyone.

I try to use “Files/Folders Meta Info” node to get file’s “last modified date” and “creation date” attribute. The node works for files whose creation date is older than their last modified date.

But for the files whose last modified date is older than their creation date,
It can not get “last modified date” and “creation date” correctly , the last modified date is same with creation date return by “Files/Folders Meta Info” node.
※ In Windows, when a file is copied and overwritten because there is same file name in the destination folder, the last modified date of the copied file is inherited from the original file.
Therefore, there are files with last modified date older than the creation date.

I used JDK to get correct last modified date and creation date in the KNIME Server by using Java Snippet.
How can I get correct last modified date and creation date of files which are in the host OS(NOT in the Kubernetes Container)
※ because I can not use Java Snippet to access files in the host OS directly.

Thanks in advance.
Ryu

Hi @laughsmile

thanks for reaching out with your question :slight_smile:

I got the part that under Windows the last modified date can be before the creation part of the file. You are expecting that the dates on which you see on Windows should be the same as when you are applying the Files Folders Meta Info Node on the HUB to those files? On KNIME Server this worked when using your Java Snippet, but not with the node, is this correct?

Best regards
Lars

@laaaarsi

Thanks for your comment.
Yes , the Files Folders Meta Info Node can not get file’s last modified date and creation date correctly, when the file’s last modified date before the creation date.
So I have to use Java Snippet to get last modified date and creation date On KNIME Server.
Ryu

So the output of your Snippet is different to the Node both run on KNIME Server. When doing the same locally the output is the same? I guess locally you are on Windows, on which machine is the server running?

Could you provide me your Java Snippet Code?

Hi @laaaarsi

Business Hub is running on the linux and on the Kubernetes Container , So Java Snippet can NOT access local files directly when using Business Hub except FTP Connector or SSH Connector etc.

Java Snippet Code of KNIME Server (Windows):


※ We can access local files directly in the KNIME Server

Thanks in advance
Ryu

So when you are running the below workflow on the KNIME Server (assuming executor and KNIME Server is on the same machine) you are getting different results?

Please set the location of the files in question in the List/Files Folders node. I just tried to reproduce but for me the output is the same. Considering that the output of the Snippet is in UTC whereas the output of the Node is UTC+1 in my case

compare_file_attributes.knwf (10.8 KB)

Hello @laaaarsi

The workflow is like the following:
The file’s creation date(2023/11/28):
image

The file’s last modified date(2017/05/19):

Workflow:


Files/Folders Meta node’s Output Table:

The creation date and last modified date is same.

※ I have to use Business Hub Workflow’s FTP Connector Node to access file in the Host OS, because can not access it directly.
※ Java Snippet in the Business Hub Workflow can not access the file “/tmp/1.txt” which is in the Host OS.
※ In the KNIME Server(Windows) which we are using, We can access the local file directly by using Java Snippet.

My Question is :
How to get the file’s creation date and last modified date of “/tmp/1.txt” in the Host OS correctly.

Thanks in advance.
Ryu

Hey @laughsmile

thanks for the very detailed explanation! I did some research and checked our code, we use this call to get the creation date of a file and as per the documentation for some filesystems there is no information about the creation date of a file and therefore the last modified date will be returned instead. This could be a explanation for the behavior of our node. Regarding the difference between the node and your commands ls - lreturns the last modified date whereas ls --time=ctime -l returns the change time of the file (see here) you could try and check the output for ls --time=creation -l or similar time arguments.

Best regards
Lars

Hello @laaaarsi

The file “/tmp/1.txt” is created in the today(2023/11/28) newly and set the last modified date to 2017/05/19 by using linux “touch” command.

The command " ls --time=creation -l" returned error:


※seems that it must use "ls --time=ctime " from the help info
※Business Hub is running in the Amazon Linux2

Is it impossible to get the creation date correctly?

Best regards.
Ryu

So it only supports those time arguments as shown in the screenshot, but I guess it says ctime is time of last change, rightß? I think there is not much we can do about it when the underlying OS/Filesystem does not support it unfortunately.

Best regards
Lars

Hello @laaaarsi

Yes , there is no creation date in the POSIX standard , there are :

  1. atime – access time = last time file opened
  2. mtime – modified time = last time file contents was modified
  3. ctime – changed time = last time file inode(metadata) was modified

According to the following link,creation date is added in some filesystems.


Ref:

I am using Amazon Linux2 whose file system is XFS5,
So if I change to Ubuntu whose file system is ext4, Can I get the creation date?

Best,
Ryu

Hey @laughsmile

I’ve found the same threads :slight_smile: So you want to change your personal (client) to Ubuntu if I understand correctly or the machine where you connect via FTP to (is it the same?)? I am not quite sure if this will work and I think you would need to try that out if you really need to have the creation date of a file.

Best regards
Lars

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.