I’m a big fan of
XBMC KODI but have an issue when it comes to the way KODI handles removing watched movies. When you delete a movie from the database (and file system if you’ve configured KODI to allow file deletion) KODI deletes the movie file but not the directory, thumbnails, and various other accompanying files. After a while you have all these orphaned movie folders lying around.
Here’s a thread on the subject: //forum.xbmc.org/showthread.php?tid=128963
Hopefully the folks at KODI will ad a configuration switch that will tell KODI to delete the media file and its accompanying directory some day. In the mean time I’ve come up with a DOS batch file that can be run manually to remove orphaned directories.
My requirements:
- check only the first level of directories off my movie folder. (To enable the batch file to look into all sub-folders just add a “/r” after “for” in the batch file.)
- Ignore folders that contain at least one example of the various movie files ex avi, iso, mkv.
- Ignore “movie sets“. Movies that are sequels or are apart of a directly related movie series. To facilitate this I add the file “folder.ignore” to the top directory of a “movie set.”
- Prompt me to delete the orphaned folders.
How to use:
- Create a text file with the .cmd extension in your movie folder directory ex “foldercheck.cmd”
- Copy the code below into your newly created file.
- Create a text file called “folder.ignore” in any folders you don’t want the batch file to check.
- Double click your newly created foldercheck.cmd file to launch the clean up script.
@rem ------start of code [updated Saturday, June 29 12:35] @echo Scanning for orphaned directories... @echo. @echo off for /d %%f in (*) do ( if not exist %%f*.mkv ( if not exist %%f*.avi ( if not exist %%f*.iso ( if not exist %%f*.ifo ( if not exist %%f*.mp4 ( if not exist %%f*.m4v ( if not exist %%f*.img ( if not exist %%f*.divx ( if not exist %%f*.ignore ( @echo Delete the following folder?: rmdir /S "%%f" ) ) ) ) ) ) ) ) ) ) @echo. @pause @rem ----- end of code