Search a database for a location to move files and add additional information to the file name when moved

I am a true rookie and have been using studio for a week. I need to search a database and return information as to where to move a file then add information to the file name when moved.
We receive hundreds of files daily from 62 districts into one folder and they need to be moved and timestamped as received. The district is the first two characters of the file name.

example: the file is named M4-6321fx3.pdf I need to take the first two characters (M4) and search a table for M4 then return the user associated with M4 and move the file to the user’s folder adding a date time format to the end of the file name. I

I think that the module I should be using is get process or invoke method but I am unsure…