It seems that your code does not work with files which name already contains a dash, does it?