Your
jpg
array contains full paths to files, so unless the
indextoremove
contains exactly the same string (which is unlikely given the variable name) this code isn't going to return anything useful:
int numIndex = Array.IndexOf(jpg, indextoremove);
In fact, what it probably returns is always -1.
If
indextoremove
contains a number then use that directly:
string p[athToFileToDelete = jpg[indextoremove];
and you'll get the right string.