added directory to inputfile in extract function