added forceMain option to find main files from endpoints even if it is not specified in metadata
added pattern option to be set by th user to match existing files in the directory