Adding the correct code to iterate through the items based on arrays
Maid.rules do
search = ["Test01","Test02","Test03","Forever.US.","Castle.US."]
replace =["Item-1","Item-2","Item-3","Forever.2014.","Castle.2009."]
def rename_item(path, search, replace)
Dir[path].each do |show|
old = show
new = show.gsub(search, replace)
puts "Reanaming #{old} to #{new}"
`mv #{old} #{new}`
end
end
rule '[TEST]' do
dir(['~/RubyTest/**/*.{txt}']).each do |shows|
search.each_with_index {|item, idx| rename_item(shows,search[idx], replace[idx]) if shows.include?(item)}
end
end
end
This seems to work not sure if it is the best way to do this though
dir(['~/Downloads/TV/**/*.{mp4,mkv,m4v}'])?rename_item?