added checking for previously completed dirs

Added checking against results directory to see which dirs were
completed previously.  Changed the working file to temp.txt; upon
completion of directory, temp.txt is renamed with its directory-based
name.