Skip to content

Instantly share code, notes, and snippets.

@alanhogan
Created October 26, 2018 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanhogan/87a95952cddfb0ebf6581f06cc6328bf to your computer and use it in GitHub Desktop.
Save alanhogan/87a95952cddfb0ebf6581f06cc6328bf to your computer and use it in GitHub Desktop.
Very good Ruby broh
#!/usr/bin/env ruby
require 'find'
puts "Deleting all .scss files !!!! !!11"
deleted = 0
Find.find('.') do |path|
if FileTest.directory?(path)
if ['npm-packages-offline-cache', 'node_modules'].include? File.basename(path)
puts "Skipping #{File.basename(path)}"
Find.prune # Don't look any further into this directory.
else
next
end
elsif File.basename(path) =~ /\.scss$/
puts "Removing #{path}"
File.delete(path)
deleted += 1
end
end
puts "#{deleted} .scss files removed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment