To me looks like "direct" has "ory" omitted, and "filename1" is a variable which is being modified 4 times instead of using four different variables. OP, then, seems to be asking about how to obtain base file name prefix (from a absolute path component) to generate four different file names from a list of four suffixes.