Class: Saber::Task::Clean

Inherits:
Base
  • Object
show all
Defined in:
lib/saber/task/clean.rb

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize, invoke

Constructor Details

This class inherits a constructor from Saber::Task::Base

Instance Method Details

#cleanObject



8
9
10
11
12
13
14
15
# File 'lib/saber/task/clean.rb', line 8

def clean
  disk_files = Pa.ls2(Rc.clean.dir, absolute: true)
  bt_files = Retort::Torrent.all.map{|t| Retort::Torrent.action("name", t.info_hash) }.map{|n| Pa.join2(Rc.clean.dir, n)}

  (disk_files - bt_files).each { |file|
    Pa.rm_r file, :verbose => true
  }
end