How can I get the end number of a array (usually OldDirName(54) but changes)

Thanks!