Hope this helps..

...]

instead of myvar[] - this gives the option to work with IDs injected into
the array
+ added option to make the original filename lowercase on the destination
file.
+ added option to provide destination filemask while using the {i} which
represents the iterator in the foreach (Which is the given ID)

I'm new to git hope I commited it right! ;-)