Return the file's creation date

Hello! Does webMethods build-in contain the fuction which can return the file’s creation date and last update date? Does anyone konw that? Thanks in advance.

For example,there are 20 files under the folder /data, wM service return the 10 files whoes creation date is 18th-Nov-2008.

Jack.

you need to write a java service.

File textfile = new File(filePath);
String lastModified = String.valueOf(textfile.lastModified());
Date dateTime=new Date(textfile.lastModified());

This will give you the lastModified timestamp or if the file is new will give you the file creation timestamp.

try it…

Thank you,Lion!I will try.
BTW,can we set interval for java service,eg: every 5minutes launch one time.

yes you can schedule the java service to run every 5min from the IS Admin screen.
Administration->Scheduler->Create Scheduled Task

Note that getting last modified timestamp is different to file create timestamp. There’s no Java API for this since create timestamp depends on OS. One way to get the create timestamp is to execute OS command to retrieve it.

The other obvious question is “Why do you need to do this?”. Are you familiar with the IS file polling “port”?

Mark

:frowning: Hi,

I am trying to capture lastModified date time for a file coming from filepolling. I am using getTransportInfo service for that. though I can see that lastModified variable is getting saved in pipeline, but its not getting mapped to any other variable.
Please let me know if I am missing anything. I am working on wM 713.
Hoping to get solution in this thread’s reply!

Thanks in advance!
Shweta

If you want to map the lastModified value into a “string”, try with WmPublic:pub.date.formatDate as a transformer with the date pattern you want.

You can also check in the Developer Users Guide the part about “Linking variables of different data types”: