My original idea was using the just the hash as filename, by this way I could have a direct access. But the customer rejected this and requested to have part of the long file name (from 11 to 1023 characters). As linux only allows 256 characters in the path and I could get duplicates with the 256 first chars, I trim teh real filename to around 200 characters and I add the hash at the end (plus a couple metadata small fields).
Yes, there requirements does not makes too much sense, but I've tried to convince the customer to use just the hash with no luck (seems he does not understand well what is a hash although I've tried to explain it several times).
That's why I need or a) use mysql or b) do a directory lising.
I would use either only a database, or only the file system. To me - using them both is a violation of KISS.
If you were able to convince them to change the directory layout, and if you are more confortable with a database - try to convince them to use a database.