Expand my Community achievements bar.

SOLVED

Is it possible to extract the asset modified date from a file uploaded to AEM Assets?

Avatar

Level 2

Files on a computer have a last modified date in their metadata. When files are uploaded to AEM, some of that metadata is kept and put into nodes. The rest gets lost, from what it seems.

I need to modify a workflow to: extract the last modified date from the file (not the AEM last modified date), and store it in a node that does not change. How can I access this metadata value from a Workflow workItem? Is this even possible to do without writing a separate service that triggers on upload, before the file gets touched by any AEM workflows?

The "Metadata Processor" step in DAM Update Asset is likely accessing the full list of metadata from the file and selectively choosing what to keep. I need to access the same file metadata, which includes the file last modified date, and I need to store it in a node. The last modified date I'm referring to is the one that shows up if you right click -> Get Info on a file on OS X for example. Any advice on the best approach to this would be greatly appreciated.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

If you use File.lastModified() you are querying the filesystem, not the metadata inside the file itself. Thus it's not preserved inside the file, and also not available inside AEM.

Jörg

View solution in original post

6 Replies

Avatar

Level 7

The easiest way I see is to use the Java File API and make a file.lastModified() call.

But as you said it needs to be a different service and wont be available in the workItem.

Thanks

Tuhin

Avatar

Employee Advisor

Hi,

Let me try to rephrase your requirement:

* I have a file (image.jpg) on my local desktop, which has a last modification date of Jan 1st 2019 (according to Finder or Explorer)

* I upload this image.jpg to my AEM

* a workflow step reads this last modification (from somewhere) and stores it in a property on the asset.

Is this correct?

In this case this metadata "last modification" is a metadata of the filesystem of your local machine. And when I upload this through the browser to AEM, this metadata is not copied over.

(It's different if this metadata is part of the image.jpg file.)

Avatar

Level 2

Yes that's correct, but the metadata is part of the image.jpg file and displayed by the file system, from my understanding.

Avatar

Employee Advisor

I doubt that a JPG contains the last modification date as metadate within itself.

You can test it: Just copy the file. If the last modification date is the same as with the original, it can be inside the file's metadate. But if the date changes the last modification date is a property of the filesystem.

Avatar

Level 2

Well, that would be creating a new file so I think it would update for other reasons. The Java File.lastModified method returns the same modified date that Right click -> Get Info returns on mac. Although I'm not sure if this is because its pulling it from the system somehow or off the file itself.

Avatar

Correct answer by
Employee Advisor

If you use File.lastModified() you are querying the filesystem, not the metadata inside the file itself. Thus it's not preserved inside the file, and also not available inside AEM.

Jörg