Module: Dafuq::FileSystem

Defined in:
lib/dafuq/filesystem.rb

Class Method Summary collapse

Class Method Details

.noswap(clean_path, recursive = true) ⇒ Object

‘remove Vi/Vim Backup/Swap *swp/swo/~ files, leftovers temporary’



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/dafuq/filesystem.rb', line 7

def self.noswap(clean_path, recursive = true)
  clean_path = File.expand_path clean_path
  file_list = FileList["#{clean_path}/#{recursive ? '**/' : ''}.*.{swo,swp}"]
  file_list.each{|file|
    next if File.symlink? file
    begin
      File.delete file
      Dafuq.log_me "Deleting: #{file}"
    rescue
      Dafuq.log_me "ERROR Deleting: #{file}"
      raise
    end
  }
end