now creates target directory if required