common method to return file/directory entry from entry element