Six Stars

How to get the date and time of file create in the Folder ??

How to get the date and time of file create in the Folder and compare to current date and time , to validation max of 6 hours of file is created or not like that we need to check.

1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars TRF
Twelve Stars

Re: How to get the date and time of file create in the Folder ??

Hi,

If I understand, you want to do some action for files created our modified for 6 hours or more.

tFileProperties give you many properties for a file, included number of milliseconds elapsed between EPOC (1970-01-01) and last modified date.

Here is an example:

Capture.PNG

tFlowToIterate generates a global variable for each property, so you can access those variables from anywhere after this component.

For example, you can test the value before to go to the next step.

In this example, tJava_3 represents this "next step", and the condition expressed in the "Run if" trigger is the following:

(TalendDate.getCurrentDate().getTime())-((Long)globalMap.get("row31.mtime")) > 6*3600*1000

So, the next step is executed only for files with "mtime" older than 6 hours (expressed in milliseconds).

Hope this helps.

 


TRF
4 REPLIES
Twelve Stars TRF
Twelve Stars

Re: How to get the date and time of file create in the Folder ??

Hi,
Check for tFileProperties.

TRF
Six Stars

Re: How to get the date and time of file create in the Folder ??

How to Use the date and Time ,

For example : One path location File its before Six hours (6 hrs) moved to create that date and time , we need to check that file date and time & we compared to current date and time , and do some-action if that file more that Six hours (6 hrs) is same location means.
Twelve Stars TRF
Twelve Stars

Re: How to get the date and time of file create in the Folder ??

Hi,

If I understand, you want to do some action for files created our modified for 6 hours or more.

tFileProperties give you many properties for a file, included number of milliseconds elapsed between EPOC (1970-01-01) and last modified date.

Here is an example:

Capture.PNG

tFlowToIterate generates a global variable for each property, so you can access those variables from anywhere after this component.

For example, you can test the value before to go to the next step.

In this example, tJava_3 represents this "next step", and the condition expressed in the "Run if" trigger is the following:

(TalendDate.getCurrentDate().getTime())-((Long)globalMap.get("row31.mtime")) > 6*3600*1000

So, the next step is executed only for files with "mtime" older than 6 hours (expressed in milliseconds).

Hope this helps.

 


TRF
Six Stars

Re: How to get the date and time of file create in the Folder ??

Thanks a lots , its working fine .

Ashok