Delete files after successful extraction

Any questions? Need some help?
Post Reply
Posts: 49
Joined: 03 Sep 2012, 10:52

Delete files after successful extraction

Post by cheesemaker » 30 Nov 2012, 16:18


How do I have to extend the Code to delete the files which have been extracted successfully? (It's out of Fully Automated Media Center)

Code: Select all

// extract archives (zip, rar, etc) that contain at least one video file
input += extract(file: input.findAll{ it.isArchive() }, output: null, conflict: 'override', filter: { it.isVideo() }, forceExtractAll: true)

User avatar
The Source
Posts: 17472
Joined: 16 Nov 2011, 08:59
Location: Taipei

Re: Delete files after successful extraction

Post by rednoah » 01 Dec 2012, 04:52

extract() should return null if something goes wrong. So just call extract() once for each archive and check the return value, if it's Files you can delete the archive, if it's null something went wrong. That's easy, the main issue is dealing with multi-volume archives.

This script shows you one way of doing it (but it assumes that there's only one single/multi-archive per folder): ... =4&t=5#p52
:idea: Please read the FAQ and How to Request Help.

Post Reply