3

Resolved

Enhancement: Delete Folder on Media Delete

description

Currently MCEBuddy has the ability to delete the source media after conversion, but the source folder is left over.

I would like MCEBuddy to have an option to also delete the media source folder if it is empty after conversion.

Currently when I use NextPVR to record an OTA TV show, NextPVR creates a folder with the file inside. After MCEBuddy strips out the commercials and places the new file in a different folder and deletes the source file, the original source folder is left behind.

comments

matt_in_detroit wrote Mar 4, 2016 at 2:07 PM

I have the same concern.

However, there are cover images loaded into most of the directories. While I have no need for the images after MCEBuddy has processed and removed the original video files, the folder is technically not empty.

rboy1 wrote Mar 4, 2016 at 3:02 PM

If you have any file MCEbuddy shouldn't delete the folder it cant' differentiate between what's needed and what's not. If this feature were to be implemented it would only be if the folder is complete emtpy. Would it still be useful?

joelshort wrote Mar 4, 2016 at 4:15 PM

I'm the original poster...
I was able to solve my particular issue outside of MCEBuddy by telling NextPVR to not create show folders. So now I just have the actual show recording in my designated file, then when MCEBuddy processes it the file is deleted and there's no left over folder. So I don't really have a use for this feature request any more, although I still think it would be a good option.

wrote Mar 4, 2016 at 4:50 PM

mbarylski wrote Mar 4, 2016 at 4:51 PM

I think it would be useful. Probably not at the top of the priority list, but I'd use the feature if it were available.

rboy1 wrote Mar 10, 2016 at 2:21 PM

Feature added in today's build of 2.4.4. BETA
When delete original option is selected the original file in Monitor Task options, the original file, supporting files with same name (XML, NFO etc) and the folder and parent folders are deleted recursively up to the monitoring root path.

mbarylski wrote Mar 11, 2016 at 1:21 PM

Thanks for the enhancement. Could the "delete folder" also be added to the archive function? I don't always delete the original file, but instead move it somewhere else to be saved just in case. But the folder where the original file was moved from is left empty even though I'd rather it be deleted.

mikeb8591 wrote Mar 20 at 12:44 AM

This is a nice addition. I use a HDHR DVR running on a NAS as my source, and it really helps to have the empty directories removed. It seems to be missing some though, names with spaces in them, and one had a '&' (but I think it also had spaces) It would be nice if those were removed as well.

This is with MCEBuddy 2.4.6 release on win7.

Thanks,
Mike

rboy1 wrote Mar 20 at 1:56 AM

Can you check the directories for hidden or system files. It should delete all Empty directories.

mikeb8591 wrote Mar 20 at 2:34 PM

I've been deleting them by hand, but will check the next one to crop up.

mikeb8591 wrote Mar 20 at 8:23 PM

Ok, there is a hidden directory in (at least this) undeleted directory, but it's empty, which I think is supposed to be removed, isn't it?

[/share/HDHomeRun] # ls -laR Once\ Upon\ a\ Time/
Once Upon a Time/:
drwxrwxrwx 3 admin administ 4096 Mar 19 21:16 ./
drwxrwxrwx 3 admin administ 20480 Mar 19 23:18 ../
drwxrwxrwx 2 admin administ 4096 Mar 19 21:16 .@__thumb/ Once Upon a Time/.@__thumb: drwxrwxrwx 2 admin administ 4096 Mar 19 21:16 ./
drwxrwxrwx 3 admin administ 4096 Mar 19 21:16 ../

mikeb8591 wrote Mar 20 at 8:25 PM

looks like it ate a newline, 'Once Upon a Time/.@__thumb:drwxrwxrwx' should start on a new line.

rboy1 wrote Mar 21 at 1:48 AM

Not it only deletes files in the current directory. It does not get into sub directories. That would be dangerous. You should find out why your software is creating sub directories. It isn't normal.

mikeb8591 wrote Mar 21 at 2:36 AM

I've asked, but I'm not holding my breath.

shouldn't it be safe to remove empty sub directories?

(Could it be a selectable option, to just blow away the directory after the recordings are all processed, regardless of chaff? That puts the control (and any blame) on me, as the one that selected the option.)

mikeb8591 wrote Mar 22 at 12:55 AM

New info. I had a couple of conversions not complete because the final directory (a NAS) wasn't available.

The HDHR directories (source) had a .@__thumb directory with several small .mpg files in them. When I enabled re-monitoring and re-processed the files, the recording directories were removed.

So, does MCEBuddy create the .#__thumb directory, and the files I observed were some type of intermediate work product? If not, MCEBuddy shouldn't have deleted the directory, correct?

Could there exist a race condition where a file isn't removed from that directory yet, so it's not empty, and isn't removed, but then winds up empty when the race-loser completes?

rboy1 wrote Mar 22 at 4:29 PM

Do it does not create that directory nor will it delete any sub directories where the file is there. Only parent directories as long as they are empty. If HDHR is creating those directories it should clean them up immediately after the recording.

mikeb8591 wrote Mar 22 at 7:47 PM

Then I'm at a loss to explain how the directories were deleted when MCEBuddy finished (re)converting the files, since they weren't parent directorories, nor were they empty when I looked.