added checking for txt path ending.