Filename value to fill in fields

I’m hoping this is possible but not sure to go about achieving it.  Is it possible to attach a file to a node and use bits of the filename to fill in fields on the node? for example customer_dept_number.txt and take the details to from the file name to fill in relevant fields.  I started playing around with rules but could only do the whole filename.

Any help would be appreciated.

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/22/feed