In my experience this is extremely frustrating. I've stumbled three times into areas where I wanted to know the order caffe processed the data. The layer may shuffle, it may get slightly offset somehow, and extensions to handling missing images via skipping also break.
I got around this by passing through an extra input into the data layer as a row ID (extending the code for ImageDataLayer). At least that tells me which row of the file its on and I can extract anything I want from this. I realize this is hacky, but I do wish caffe had a better way of handling this, just assuming that it won't matter or that you can calculate it is not helpful, especially to those new to caffe. You still do not have to pass this information to any other layer (except maybe a silence layer).