This could blow up if file name is not what you expect and index is -1. Shouldn't happen in theory, but need to make sure things to fail to badly.