You should use spawn() everywhere. You cannot use exec() for one of the zip calls below.