From Robert Osfield, modified the above so that the number increments come after the filename rather than before.