Delete files after successful extraction

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

Delete files after successful extraction

Post by cheesemaker »

Hi,

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)
Thanks,
cheesemaker
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Delete files after successful extraction

Post by rednoah »

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):
http://filebot.sourceforge.net/forums/v ... =4&t=5#p52
:idea: Please read the FAQ and How to Request Help.
Post Reply