This would be a lot simpler if their was any standardization or folder name or file name structure that could be keyed upon.
It may be easier to use code since you could parse it from the right instead, I also believe their are some functions alreay created for parsing file paths to get the specific filename.
However in InfoPath you can nest Substring functions. But again if their are a variable number of folders this can be tough.
It might be best to have some extra fields to run this through.
Set Field1 substring-after(substring-before(Field, "."), "\\")
Set Field2 substring-after(Field1, "\")
Conditional Contains(Field2, "\") set Field3 substring-after(Field2, "\")
Conditional Not(Contains(Field2, "\") set FieldFinal Field2
Conditional Contains(Field3, "\") set Field4 substring-after(Field3, "\")
You would just need to continue rules on each field for as many as you thought neccessary.
Not the most elequent but once it is setup would work fine.