08-14-2012 08:04 AM
Most users would like an object to remain in a trashcan a certain number of days to ensure the 'delete' of the file was not a mistake. So how can a file remain in the trashcan for 'N' number of days and then be deleted? A scheduled job can be setup to automate the cleanup of a trashcan. However, in order for this to work, a modification needs to be made to the object in the trashcan in order to make sure that object has reached it maturity (I.E. spent enough time in the trashcan before being permanently deleted). The reason for this modification is, when an object is deleted in SDD, the modification date of the object in the trashcan doesn’t change. See Illustration below: The SDD_hierarchy_model2.xls file was created (and not modified) on 11/18/2011.
When the object SDD_hierarchy_model2.xls is deleted, the Created and Modified date remains the same in the trashcan.
Therefore, if you designate a cleanup cycle for a given trashcan to be seven days (an object can stay in the trashcan seven days before permanent deletion) and the modification date is not altered, an object that was created eight days ago and then deleted will only be in the trashcan 1 day. It will be deleted on the first cleanup cycle since the difference from the modification date and the current date is greater than the cleanup cycle.
In order to prevent this from happening, the object needs to be modified in some way. This will alter the modification date of the file to when the object was deleted.
This can be programmatically accomplished by altering a rarely used metadata field for the object (keywords). The scheduled program would first check the object for a date in the keyword field, if it doesn’t find one, it adds the current date (day 1 in trashcan).
When the schedule runs, the SDD_hierarchy_model2.xls file Modified date is altered:
Looking at the actual properties of the SDD_hierarchy_model2.xls file, the modification by the scheduled program show the Keywords: metadata filed has ben updated.
Upon subsequent checks (as days go by) this date information is checked against the current date. Once maturity has been reached (difference of day(s) equals the maximum time kept in the trashcan) the item can be programmatically deleted using the SDD API deletefile macro. By using this coding practice, the problem of exceeding a trashcan’s capacity will not be encountered.