def self.int_to_splitted_path(i_value,value_length,base_folder,suffix="")
file_name = Integer(i_value).to_s
raise RangeError,"value_length must bigger than 0" if value_length < 1
raise RangeError, 'i_value length is bigger than value_length' if file_name.size > value_length
file_name = file_name.rjust(value_length, '0')
new_path = base_folder.dup
group_regex = ""
i = value_length
group_cnt = 0
loop do
group_cnt += 1
if i > 2
group_regex << "(\\d\\d\\d)"
i -= 3
break if i < 1
else
group_regex = "(#{"\\d"*i})" + group_regex
break
end
end
file_name.gsub(/#{group_regex}/) do |hit|
1.upto(group_cnt) do |i|
new_path << "/#{Regexp.last_match[i]}"
end
end
new_path << suffix if suffix != ""
return new_path
end