Created
December 21, 2015 10:57
-
-
Save yyjim/7a9b0367860d1acd0585 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
working_dir = File.expand_path File.dirname(__FILE__) | |
["drawable-xxhdpi","drawable-xhdpi", "drawable-hdpi", "drawable-mdpi"].each do |dir| | |
directory = "#{working_dir}/#{dir}" | |
FileUtils.rm_rf(directory) | |
FileUtils.mkdir_p(directory) | |
end | |
Dir.entries(working_dir).each do |filename| | |
if filename =~ /(.*)_(x{0,2}h|m)(\..*)$/ | |
new_file_name = "#{$1}#{$3}" | |
FileUtils.mv("#{working_dir}/#{filename}", "#{working_dir}/drawable-#{$2}dpi/#{new_file_name}", :force => true) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment