Adds trapping to avoid read-only file error and check to
skip copying file if unchaged.