cancel
Showing results for 
Search instead for 
Did you mean: 

Created/modified props for uploaded file

mrgrechkinn
Champ in-the-making
Champ in-the-making
Hello,

I have a question about created and modified date for uploaded file. Why those dates are different?
I have an inbound rule action, this action triggers when file just uploaded to Alfresco and when it was moved from other folder. How I can determine that that is new file when action was triggered.

I'm compare the created and modified date before, but they not equals now it work's before.

Regards.
3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator
Hello,

the created date is set when the node is first created while the modified date is automatically updated when the node is modified. Now, even in the transaction that uploads a new file, these dates can be different, if the transaction does not complete within a certain amount of time (< 1 s) and some action / logic (inbound rule, policy) modifies some aspects / properties of the uploaded file after creation in that same transaction.

Using inbound rules, you can never be sure wether this is a really new file or just some file that has been moved into the directory. Rules configuration doesn't care about that - only with policies can you make that distinction.

Regards
Axel

romschn
Star Collaborator
Star Collaborator
When a new file is uploaded, the created date and modified dates will remain the same.
Also if you copy the node from one folder to other, both dates will have a new value but same.
When you move a node from one folder to another, it will have both the dates changed - there will be a minor change if you take a look at the complete date with timestamp.

Hence, in your scenario - it would be pretty simpler to check if both the dates are equal (with timestamp) it's new upload or a move otherwise.

Hope this helps.

Thanks

afaust
Legendary Innovator
Legendary Innovator
Hello,

depending on the versino of Alfresco, some of the statements of either me or romsch may not be correct, as minor details may have been changed.

Speaking from a partner perspective where I use Alfresco 4.1.x in customer projects: When a new file is uploaded, the created and modified dates will only be the same IF the last update due to a rule / policy occurs within a 1000 ms window of the creation. The same applies to copies.

When you move a node, only the modified date is updated - since it still is the same node, it would not make sense if the created date is changed.

As before, you can not be 100 % sure within a rule wether a node has been created or just moved. Only in those instances that the dates are truly identical (the transaction completed within a 1000 ms window) can you safely assume a creation. In all other constellations you only know that the node is "new to the folder"

Regards
Axel