Does anyone know a way of setting up the Index & Detail Folder locations so that they point to a folder based on the Index (category) name from the feed?

For example a simple two-tier system with a Product feed of:
Stock Number

The location of the Index files should be:

and the location of the Detail files should be:

Where the Category subfolder is generated from the feed.
Almost like putting a tag in the folder location I guess?
Hope this makes sense.