mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 08:48:51 -05:00
* keep clean-root folders by default, i.e. exclude from delete
This commit is contained in:
parent
fc1c8a26e2
commit
3bcfab4dc9
@ -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] : [])
|
||||
}
|
||||
}
|
||||
|
@ -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) } }
|
||||
|
Loading…
Reference in New Issue
Block a user