How can I find orphaned files in the Vault?

Hi, I want to track the amount of Files that are not related to a Document or Change Processes anymore. I noticed that these unrelated files are somehow assigned to the SystemFileContainer Orphaned Files Container. SystemFielContainer is used as PolySource in FileContainerItems. But I have some trouble to find the right query, to detect all of my orphaned Files. Does somebody have an example query for finding orphaned files? Or maybe just some hints, how these different ItemTypes stick together? Thanks and best regards! Angela
  • Hi Angela, You can use the sample code below to iterate through all of the Orphaned files. Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hi Chris, Thanks for the fast answer and the code sample! I didn´t know about the FileContainerLocator. Finally I think I understand what the File_Handling.pdf provided in the Documentation folder want´s to tell me. Now let´s see if I get things right: 1. Regular files referred to ECOs, Documents, etc. -> no container assigned 2. Regular files removed from ECOs, Documents -> Orphaned Files Container -> can be automatically deleted when using the Force.Delete.Orphaned.Files Variable 3. Thumbnails, Files created by conversion server or any other files without container -> Global Files Container I wonder what´s the best way to clean up historic conversion server files? The files are easy to detect, as they all share a similar checkout path. But I do not think it´s good idea to remove them automatically. Do you have any recommendations? Right now the amount of Converser Server files is no problem, so this is more a question of "how to do things the correct way".
  • Hi Angela, You are correct about the behavior of Files and Containers expect for one thing. Files that are related to ECOs, Documents, etc. do have a container which corresponds to the ID of the relationship item. So a File related to a Document will have it's container set to the ID of the Document File relationship. In terms of recommendations for cleaning up older conversion server files, there's no "correct" way to do this. It's entirely dependent on your specific needs. If the amount of conversion server files is not a problem, you could not worry about cleaning them up at all. However, if it does eventually become a problem, one solution could be to periodically run a method that checks the age of the file using the created_on property and removes it if it is older than some amount. Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hi Chris, thanks for the additional feedback, I very much like the idea to use a periodic method for the clean up based on the created_on property! Right now I am quite happy with our current file vault, it´s still quite tidy.
  • Hi Christopher, I have the same need but I can't find your sample code. Is it still up?

  • Hello,

    The code has since been made into a community project which you can find on the Aras Labs GitHub here.

    Chris

  • Hello Chris,

    Can something similar be achieved for Parts? I mean can we pull up all Parts which are orphaned in the system. I know we can query that but it would take ages to process if we have huge database. Do you think we can have any different solution for this? Please let me know

  • Hi Mithun,

    This is a separate question from the one Angela originally asked. Could you create a new forum post to ask this? It'll help increase visibility to the whole community, so you can get an answer faster.

    Additionally, could you elaborate on what you mean by an "orphaned Part" when you create that new post? Do you mean a Part hat is not classified as an Assembly and is also not related to any other Parts?

    Chris

  • Yes you got that right Chris.

    I will be opening a new forum post for the same.

    Thanks