Also check whether the target exists when creating new folders (see #5260)