Page 1 of 1
Delete empty folders
Posted: 22 Jan 2012, 14:11
by pr1nc1p3
When move all files from a directory is very useful delete that folder recursive like Musicbrainz Picard.
Re: Delete empty folders
Posted: 22 Jan 2012, 15:03
by rednoah
I don't really plan on doing any kinda of "delete" operations. Empty folders / jpg / NFO / etc. But there FileBot scripts for that if you want.
Re: Delete empty folders
Posted: 09 Feb 2012, 11:00
by rednoah
Thought about adding this, but there's conflicts with people renaming e.g. .../Incoming/*.avi which would result in FileBot deleting their default incoming folder (even if empty still annoying). So while it makes sense for some cases, it's annoying for others, and it's pretty hard to auto-detect which one it is.
Re: Delete empty folders
Posted: 09 Feb 2012, 11:37
by thequestion
I would rather see this in a filebot script, which is run after filebot has ben running, sort of cleanup script if a user wants to delete old empty folders etc.
Re: Delete empty folders
Posted: 09 Feb 2012, 11:56
by rednoah
Well, i don't plan on adding that to the GUI and i think a "default shutdown script" would be overkill as well. Because one can just do a script it like filebot && filebot -script myPersonalCleanup.groovy but deleting empty folder manually takes like 1 second.
Re: Delete empty folders
Posted: 09 Feb 2012, 13:05
by thequestion
yes I was thinking more like:
Code: Select all
#!/bin/bash
#
filebot -- "params I want to use"
find /dir/to/my/movies/ -type d -name '*' -exec rmdir {} \;
Not a working script but an idea, also rmdir only works in empty folders.
Re: Delete empty folders
Posted: 09 Feb 2012, 13:52
by rednoah
Yep, something like that is easy to do and everybody can customize it to exactly what they want. Though I'd do the clean up via
Code: Select all
filebot -script http://filebot.sf.net/scripts/cleaner.groovy -trust-script /path/to/my/downloads/
hehe

Re: Delete empty folders
Posted: 28 Aug 2012, 10:08
by pr1nc1p3
Delete operations+ housemade scripts+novice users = Nuke file systems.
Maybe this is the only delete operation filebot must do auto.
Re: Delete empty folders
Posted: 28 Aug 2012, 11:25
by rednoah
That's why people should just use my predefined stuff:
Being able to modify things is just an added bonus.
Re: Delete empty folders
Posted: 04 Nov 2014, 22:06
by vletroye
+1 on Pr1nc1p3's principe
Fortunately I tried first in test mode: filebot.exe -script fn:cleaner "V:\Path\To\MyMovies" --action test 2> filebot-error.log 1> filebot.log
But apparently, by default, filebot wanted to delete all my folders still containing .iso, .avi or .mp4
Ex.: filebot.log
Code: Select all
Delete V:\Path\To\MyMovies\Tactical Force (2011)\Tactical Force (2011) [1080p.x264.].iso
Delete V:\Path\To\MyMovies\Taxi 1 (1998)\Taxi (1998) [480p.DivX.MP3].avi
Delete V:\Path\To\MyMovies\Taxi 2 (2000)\Taxi 2 (2000) [360p.DivX.MP3].avi
Delete V:\Path\To\MyMovies\The Artist (2011)\The Artist (2011) [1080p.x264.AAC].mp4
Delete V:\Path\To\MyMovies\The Experiment (2009)\L'Expérience (2010) [480p.XviD.AC3].avi
Delete V:\Path\To\MyMovies\The Master (2012)\The Master (2012) [480p.XviD.MP3].avi
Wierd as avi and iso are recognized by filebot as movies, isn't ?
Extrapolating the doc
here, I tried to delete only the empty folders, using an empty list of extensions, but without more success: filebot.exe -script fn:cleaner "V:\Path\To\MyMovies" --action test --def "exts=" 2> filebot-error.log 1> filebot.log
I think it's time for me to go to sleep

Re: Delete empty folders
Posted: 05 Nov 2014, 03:57
by rednoah
That can't happen. Unless the file size of the video file is less than 20 MB.
@see
https://github.com/filebot/scripts/blob ... ner.groovy
Looks like you have organized and messy files/folder all in the same structure. You have experienced one of the many reasons why this is a bad idea.
Re: Delete empty folders
Posted: 05 Nov 2014, 08:40
by vletroye
Well... I have organized all my movies for Plex Media Server...
So, as far as movies are concerned (opposite to series), there is only one movie per folder and all the folders are in one common root folder.
I think that this is ok?! Otherwise, I would be in trouble with Plex too.
A few weeks ago, I discovered filebot and renamed all my movies with their French title. It went very well
I wanted now to rename also the folders as I noticed that some of them were still in English instead of French.
I clearly understand now that I should move them to another root folder instead...
But still, the avi and iso candidates to be deleted are much larger than 20MB ?!
=> I will check asap if this can be due to a bug with my "File System" (FlexRaid) returning the wrong size to filebot...
Indeed, the files renamed by filebot used to be displayed as 0 Bytes once moved with my "File System", due to an alternate stream hiding the main file stream (FYI: possibly see my report here
http://forum.flexraid.com/index.php?topic=4166.0).
Is by any chance such an alternate stream added into the files when renaming movies with filebot ?
Re: Delete empty folders
Posted: 05 Nov 2014, 11:00
by rednoah
Quick look at the code:
Code: Select all
if ((f.isVideo() || f.isAudio()) && fsize < minsize)
return true
So yes, if file size is 0 then the cleaner script will think that these files are useless and should be deleted. That's why deleting things automatically is a bad bad idea!!!
I think you can pass in
--def minsize=0 so to ensure that
fsize < minsize is never true... better try with
--action test first!!!
PS: FileBot does use alternative streams / xattr / extended attributes to store metadata.
@see
viewtopic.php?f=3&t=2047
Re: Delete empty folders
Posted: 05 Nov 2014, 20:05
by vletroye
I confirm my the FileSystem his hiding the main stream and returning the size of the alternate stream instead... (by accident, I have only alternate streams for avi and iso that I renamed recently with filebot).
A fix is available for this FileSystem.. So, "tout va bien"
