This function needs a comment to what it does. Why don't you give the file-path as one argument?