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.
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.
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.
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
is working on a reply...