Last active
September 16, 2020 02:25
-
-
Save tinogomes/105767 to your computer and use it in GitHub Desktop.
Remove files from
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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