N.Y. Criminal Procedure Law § 330.20
1. Definition of terms. As used in this section, the following terms shall have the following meanings:
18. Notwithstanding any other provision of law, no person confined by reason of a commitment order, recommitment order or retention order to a secure facility may be discharged or released unless the commissioner shall deliver written notice, at least four days excluding Saturdays, Sundays and holidays, in advance of such discharge or release to all of the following:
21. Appeals. (a) A party to proceedings conducted in accordance with the provisions of this section may take an appeal to an intermediate appellate court by permission of the intermediate appellate court as follows:
(d) The court from or to which an appeal is taken may stay all proceedings to enforce the order appealed from pending an appeal or determination on a motion for permission to appeal, or may grant a limited stay, except that only the court to which an appeal is taken may vacate, limit, or modify a stay previously granted. If the order appealed from is affirmed or modified, the stay shall continue for five days after service upon the appellant of the order of affirmance or modification with notice of its entry in the court to which the appeal was taken. If a motion is made for permission to appeal from such an order, before the expiration of the five days, the stay, or any other stay granted pending determination of the motion for permission to appeal, shall: