Class: BackupOrganizer::FileMover
- Inherits:
-
Object
- Object
- BackupOrganizer::FileMover
- Defined in:
- lib/backup_organizer/file_mover.rb
Class Method Summary collapse
Class Method Details
.move_file(file, rule, destination) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/backup_organizer/file_mover.rb', line 11 def self.move_file(file, rule, destination) return if rule.applies_for?(file) return FileUtils.rm_rf(file) if destination == :delete FileUtils.mv(file, destination) end |
.move_files(source, rule, destination) ⇒ Object
5 6 7 8 9 |
# File 'lib/backup_organizer/file_mover.rb', line 5 def self.move_files(source, rule, destination) Dir[File.('./*', source)].each do |file| move_file(file, rule, destination) end end |