Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • CodeMaster2008 151 posts 184 karma points
    Apr 13, 2010 @ 15:25
    CodeMaster2008
    0

    How to deal with orphan files?

    I'd like to confirm if it's the expected behavior:

    1) I created a document type (for an article) and added an upload property to it
    2) After that, i created an article, uploaded an image and clicked save and publish

    I noticed the image and thumbnail was saved under "media/816/image.jpg" and "media/816/image_thumb.jpg".

    3) I deleted the document and went back to see if the image was deleted as well and for my surprise, the folder with the thumbnail was still there.

    From my point of view it's a big issue because this image is not available through the media gallery and the only way to see it is accessing the media folder via ftp and even by doing that, it will be hard to identify all the subfolders which are just numbers.

    The bottom line: after create and delete a few hundred articles we will end up with tons of orphan files we will be unable to identify.

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Apr 13, 2010 @ 15:28
    Sebastiaan Janssen
    0

    Unfortunately, there is currently no built-in way to automatically delete a file when the document is deleted. I suggest you write your own eventhandler that hooks into the Document's BeforeDelete event and removes the file from the disk before the document is deleted.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 10x admin c-trib
    Apr 13, 2010 @ 15:35
    Dave Woestenborghs
    0

    I created a dashboard control that looks for these orphan files by doing a compare between files system and the umbraco DB.

    I will package up later on a will make available.

  • CodeMaster2008 151 posts 184 karma points
    Apr 13, 2010 @ 15:57
    CodeMaster2008
    0

    I see, the eventhandler sounds like a perfect solution.
    Anyway, I'll be waiting for your dashboard control dawoe, it's a very interesting idea as well.

  • Petr Snobelt 923 posts 1535 karma points
    Apr 13, 2010 @ 16:18
    Petr Snobelt
    1

    I think its for revert/trash functionality.

    You can chose another file then again save and publish. But later you want go back to previous version and image is still there.

    Petr

  • CodeMaster2008 151 posts 184 karma points
    Apr 13, 2010 @ 21:03
    CodeMaster2008
    0

    That's probably the reason. After empty the recycle bin i noticed the file/image was gone, however the thumbnail was still there.
    Could it be because the thumbnail is not the one associated to the databased? Don't know but the perfect behavior (for me) would be:

    1- Remove file
    2- Look for thumbnail on the same directory, which is "FileName+thumb+.extension" and remove it
    3- If after remove both files the folder is empty, remove folder.

    If the above was applyed to every file added to the website through the upload data type and every item under the media section, the only orphan files would be those the user add using the HTML editor. However, since those are visible under the media section it wouldn"t be a problem.

  • Petr Snobelt 923 posts 1535 karma points
    Apr 15, 2010 @ 09:31
    Petr Snobelt
    0

    IMHO it is not big issue, but you can submit patch for this :-) ... or create codeplex item.

    one note: you can set umbraco to create multiple thumbnails (with different sizes).

    Petr

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies