when overwrite flag is set, should check if the target exists, rather than the targetPath