What exactly are you trying to do? $mid is useful, however, depending on what you are trying to do, there might be other options that will do the work for you where you might be doing it the long way, such as directory/file parsing.