I realize that this topic hasn't been replied to in ages, but I'll post this almost-solution in case someone else needs it. A counter can easily be created by using javascript.
How to count number of list-items:
//This goes in the <head> section of the page
<script type="javascript">var item_counter = 0;</script>
//If you for example want to count number of mp3 files put this in section [file.mp3]
<script type="javascript">item_counter += 1;</script>
//Then place the following inside section [file.mp3] where you want to output the count-number
<script type="javascript">document.write(item_counter);</script>
However, since the original question was to have short and unique id's instead of using long filenames, I would suggest using %item-size-b% (filesize in bytes). It will output something like "45321564". Since you rarely have two files that are identical in byte-size, I think you won't have any problems with duplicate id's with this solution.