Skip to content

Instantly share code, notes, and snippets.

@tinogomes
Last active September 16, 2020 02:25
Show Gist options
  • Save tinogomes/105767 to your computer and use it in GitHub Desktop.
Save tinogomes/105767 to your computer and use it in GitHub Desktop.
Remove files from
def p80(text = '')
p text
yield if block_given?
end
def remove_files_from(dir_name, subdir = true)
dir = Dir.new(dir_name)
dir.sort.each do |file_name|
unless file_name =~ /^\./
file = "#{dir_name}/#{file_name}"
if File.directory?(file) && subdir
remove_files_from(file, subdir)
else
p80("removing: #{file}") { `rm #{file}` }
end
end
end
end
#show_files('rspec')
$*.each do |dirname|
remove_files_from dirname
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment