A particular file/folder cleanup... Anybody know?
#1
Hi,

I've been facing this problem for years and it is only incidentally connected to Kodi but I was wondering what others are doing maybe I can finally solve it since the problem is getting bigger and bigger... Sad

Basically I have all my KODI Movies in separate movie folders and inside these folders there is extrafanart, extrathumbs folders; fanart.jpg poster.jpg, srt, trailer files etc... Been collecting movies in my collection since first XBMC(or P if my memory serves) version some 18+ years...

So my problem is that, since I can remember, Kodi has always given the option to delete a movie from the interface via right click, remove from Kodi/Delete File option and this deletes the actual movie but the rest of the files mentioned above and more remain there... Little by little in all the years all this "junk" begins to take quite a big amount of space in my many terabyte collection (apart from neatness of my collection)...

Real Example: 

[Move Title] (YEAR)
   extrafanart
       [RANDOM LETTERS].JPG
       [RANDOM LETTERS].JPG
       [RANDOM LETTERS].JPG
   extrathumbs
       thumb1.jpg
       thumb2.jpg
       thumb3.jpg
   fanart.jpg
   poster.jpg
   [Movie Title].en.srt
   [Movie Title].nfo
   [Movie Title].tbn
   [Movie Title]-fanart.jpg
   logo.png
   [Movie Title]-trailer.en.srt
   [Movie Title]-trailer.mov

Notice that in the above example there is no longer a [Movie Title].mkv or such inside the "[Move Title] (YEAR)" folder as I have deleted the movie from the KODI interface...

Is there a way to mass identify and mass delete these "junk" folders from Kodi or an external utility or script or something that people are using or know about? Obviously the Movies folder contains both movies folders that still have the movie in them and the example like the above so any utility needs to identify the difference and delete only those folders that no longer have the movie in them.

Any ideas ?

Tks!
Reply
#2
(2021-03-14, 21:04)dejjem Wrote: Is there a way to mass identify and mass delete these "junk" folders from Kodi
No there is not. You are better off deleting the movie folder by exiting back to the operating system. I am not aware of any add-on that can do this either.

Some issues you may not be aware of:
* tbn files have not been used for many versions of Kodi
* extrathumb and extrafanart folders are not used by Kodi.
* logo.png should be named clearlogo.png
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#3
Hi Karellen, thank you for replying. Was afraid there was not Sad and also thank you for the issues you noted. I can easily delete tbn files recursively and mass rename logo.png.

Was thinking there was something outside of kodi - some program to help that kodi people knew to mass delete junk folders about hence I posted in this section...

Been looking for this for quite a while on and off. So I have to look at my last resort (was hoping to avoid it) and shop around to commission a programmer to do a custom program for me to do this. It shouldn't be too difficult but my programming skills are less then zero. My specs will include one single line lol - Delete all directories recursively within a path I give the program that are more then the directory size that I can define inside the same program ex: All directories within c:\movies that have less then total of 400MB in them. Cannot believe such a tool does not exist in the world Sad !
Reply
#4
(2021-03-15, 19:55)dejjem Wrote: My specs will include one single line lol - Delete all directories recursively within a path I give the program that are more then the directory size that I can define inside the same program ex: All directories within c:\movies that have less then total of 400MB in them. Cannot believe such a tool does not exist in the world Sad !

You can find such folders or files using Agent Ransack https://www.mythicsoft.com/agentransack/ and delete from the results. I'm sure that there are a lot of other file management tools that would do it too. Karellen simply answered that you could not do it with Kodi or an addon, nothing about other software.
Reply
#5
(2021-03-16, 09:21)DaveBlake Wrote:
(2021-03-15, 19:55)dejjem Wrote: My specs will include one single line lol - Delete all directories recursively within a path I give the program that are more then the directory size that I can define inside the same program ex: All directories within c:\movies that have less then total of 400MB in them. Cannot believe such a tool does not exist in the world Sad !

You can find such folders or files using Agent Ransack https://www.mythicsoft.com/agentransack/ and delete from the results. I'm sure that there are a lot of other file management tools that would do it too. Karellen simply answered that you could not do it with Kodi or an addon, nothing about other software.
Thank you for this... Smile Didn't actually manage to do it via Agentransack as it only sees each file size rather then the whole [Movie Title] folder size (or maybe I don't know how to correctly use it...) but your post gave me the correct idea and I found that this software works perfectly https://www.jam-software.com/treesize_free. Posting here just in case others have the same issue 1) You scan the movie folder with Treesize 2) You click on the Size column to sort by size  3) You select those that are small sized movie folders 4) You delete the selected folders directly from Treesize. With both you and Karellen's help my collection is much cleaner (and more environment/cost friendly as less HD's/scanning resources are needed etc... - trailers especially for movies that no longer exist during the years also took up a significant chunk of combined space).
Reply
#6
For future Googlers: identifying this sort of thing in Powershell is pretty easy
 
Code:
Get-ChildItem "PATH TO MOVIES STORAGE" -Directory -Recurse | ForEach-Object { IF ( (Get-ChildItem -literalpath $_.Fullname -File -Recurse | Where-Object {".mkv|.avi.|.mp4" -match $_.extension}).count -lt 1 ) { Remove-Item -literalpath $_.Fullname -Confirm:$false -Recurse -Force -ErrorAction SilentlyContinue }
ELSE { } }
Reply
#7
Thread belatedly moved to OS independent support
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply

Logout Mark Read Team Forum Stats Members Help
A particular file/folder cleanup... Anybody know?0