#!/usr/bin/env ruby
def allowed_ext?(file)
['jpg', 'JPG', 'gif', 'GIF', 'png', 'PNG'].include?(file.split(".").pop)
end
Dir.open('.').each do |file|
if allowed_ext?(file)
file_downcase = file.downcase
system "mv ./#{file} ./#{file_downcase}"
end
end
Dir.open('.').each do |file|
system "convert #{file} -resize 300 #{file}" if allowed_ext?(file)
end
Комментариев нет:
Отправить комментарий