Copied to clipboard

Flag this post as spam?

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


  • Mark 255 posts 612 karma points
    Feb 12, 2015 @ 15:56
    Mark
    0

    Media item deletions - do they ever cause file to be removed from the file system?

    Umbraco 7.2.1

    I've tried deleting a media item of type "Image" from the Media section. When I look in the media folder on the file system, I see the file and it's containing folder are still there.

    I get the same result when I use MediaService.Delete(IMedia media, int userId = 0).

    So, my question is, are the file system files and folders that are saved into the "/media" folder ever deleted?

    Ideally I would like to know in what situations file system files and folders are deleted, and in what situations they are not.

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Feb 13, 2015 @ 15:55
    Alex Skrypnyk
    0

    Hi Mark,

    This is the default Umbraco behavior unfortunately. To remove the file you have to click the "remove file" checkbox and Save before you actually delete the node. Another way is to create event handler which will works at node deleting event and will remove file from disk.

    Also Umbraco has some packages that do some cleaning of media folder. For example : https://our.umbraco.org/projects/backoffice-extensions/falm-housekeeping

    Thanks, Alexander

  • 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