The officer in charge of any prison or camp must take in charge any property, money or other thing of value in the possession of any convict at the time of the delivery of such convict to him and shall pay or deliver the same to such person as the convict may in writing direct, to the convict on his discharge or to his personal representative in case of his death previous thereto, and should no personal representative be appointed within six months after his death, then into the State Treasury.