1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00

* keep clean-root folders by default, i.e. exclude from delete

This commit is contained in:
Reinhard Pointner 2013-05-07 15:01:50 +00:00
parent fc1c8a26e2
commit 3bcfab4dc9
2 changed files with 3 additions and 2 deletions

View File

@ -321,6 +321,6 @@ if (clean) {
// deleting remaining files only makes sense after moving files
if ('MOVE'.equalsIgnoreCase(_args.action)) {
_log.info 'Clean clutter files and empty folders'
include('fn:cleaner', [:], !args.empty ? args : ut_kind == 'multi' && ut_dir ? [ut_dir as File] : [])
include('fn:cleaner', [root:true], !args.empty ? args : ut_kind == 'multi' && ut_dir ? [ut_dir as File] : [])
}
}

View File

@ -1,4 +1,5 @@
// filebot -script fn:cleaner [--action test] /path/to/media/
def deleteRootFolder = tryQuietly{ root.toBoolean() }
/*
* Delete orphaned "clutter" files like nfo, jpg, etc and sample files
@ -29,4 +30,4 @@ def clean(f) {
args.getFiles{ isClutter(it) && !it.dir.hasFile{ (it.isVideo() || it.isAudio()) && !isClutter(it) }}.each { clean(it) }
// delete empty folders but exclude given args
args.getFolders().sort().reverse().each { if (it.listFiles().length == 0) { clean(it) } }
args.getFolders().sort().reverse().each { if (it.listFiles().length == 0) { if (deleteRootFolder || !args.contains(it)) clean(it) } }