If they are named with a strict convention you could just code this convention in your dataset (e.g. my label-files are named just like the data files (except the file extension) and you could simply cut off the last number doing the path mapping.